Hidden even Function ID generates error

Asked

Viewed 66 times

0

As it was not clear I will remake the doubt.

follows the code that is run as desired.

<html>
<head>
    <title>Teste</title>
</head>
<body>
    <form action="/teste_andre.html" method="get" id="form1" onsubmit="return valida()">
        <input type='hidden' value='1' name='teste' id='teste'>
    </form>

    <button type="submit" form="form1" value="Submit">Submit</button>
    <script type="text/javascript">
        function valida(){alert('valida');}
    </script>
</body>
</html>

If I change the Hidden field ID from 'test' to 'validate' Does NOT show Alert and does not error on console.

I just want to know why Hidden can’t have the same id as the function name?

  • shows the button code

  • Already took a look at the console ?

  • 3

    Show the rest of the code to see how you are implementing this form

1 answer

-2

Browser other questions tagged

You are not signed in. Login or sign up in order to post.