Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

274
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!