Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

271
Vistas
HTML Form onsubmit

In HTML5, returning false in a form gives the red line, indicating there is an error, even though I am able to achieve my expected output. Is there any way to fix this line and have a bug free code as it is triggering my OCD. Also, I am a big beginner with my code so please try to keep it as simple as possible. i do not understand JQUERY at all.

return false here brings a red line. even tried it with the "return <function()> and that also gave red line

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

<!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>
about 4 years ago · Juan Pablo Isaza Denunciar

0

<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>
 

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda