En HTML5, devolver falso en un formulario da la línea roja, lo que indica que hay un error, aunque puedo lograr el resultado esperado. ¿Hay alguna forma de arreglar esta línea y tener un código libre de errores, ya que está activando mi TOC? Además, soy un gran principiante con mi código, así que trate de mantenerlo lo más simple posible. No entiendo JQUERY en absoluto.

<!DOCTYPE html> <html lang="en"> <head> <title>Title of the document</title> </head> <body> <form action="#" method="get" onsubmit="userRegister1(event)"> <input type="text" name="name" /> <button type="submit">Click me</button> </form> </body> </html> <script> function userRegister1(event) { event.preventDefault(); return false; } </script> <form action="#" method="get"> <input type="text" name="name"> <button type="submit" onclick=" // you can code javascript code here, this's same how you code in <script>.....</script> function userRegister1(){ console.log('your code in userRegister1 function'); } userRegister1(); // so you return false that's wrong syntax //onsubmit='userRegister1(); return false;' // return must be use in function, in this case you can use in function userRegister1() // BUT i don't suggest use this way ">Click me</button> </form>