Solution 1 :

<!DOCTYPE html>
<html lang="en">
    <title>Title of the document</title>
    <form action="#" method="get" onsubmit="userRegister1(event)">
      <input type="text" name="name" />
      <button type="submit">Click me</button>

  function userRegister1(event) {
    return false;

Solution 2 :

<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');

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

Problem :

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


Comment posted by Bravo

does hovering over the red line give helpful message?

Comment posted by Barmar

It might just be warning you that if you’re doing anything more complicated than calling a single function, you should use an event listener instead of inline JavaScript. But without the detailed explanation of the squiggle, it’s hard to know.

Comment posted by

@Bravo perhaps jQuery was mentioned because of this?

Comment posted by edit

Your answer could be improved with additional supporting information. Please

Comment posted by Bravo

What even is this!!!!

Comment posted by Ziur Olpa

describe your answer out of the code if you can, welcome to SO!