I have the following form. When I have the input name set to submit
, it won't submit the form, why is that?
<form id="login" method="post" action="">
<input type="hidden" name="username" value="someval">
<input type="hidden" name="userpass" value="somepass">
<input type="hidden" name="submit" value="Login">
</form>
<script type="text/javascript">
var timeout = 12;
setTimeout(function () {
document.getElementById('login').submit();
}, timeout);
</script>
Error message is:
Uncaught TypeError: document.getElementById(...).submit is not a function(…)
I guess the submit name is erasing the submit function in some way?
JSFiddle with and without submit name.
edit to my question:
How can I submit the form using js when it includes input named submit?