Why doesn't the following code work?
<html>
<body>
<form id="myForm" action="http://example.com" method="POST">
<input type="text" name="engine" value="v2.5" />
<input type="text" name="verify" value="2" />
<input type="text" name="submit" value="Save" />
</form>
<script type="text/javascript">
document.getElementById("myForm").submit();
</script>
</body>
</html>
I'm getting the following error:
Uncaught TypeError: document.getElementById(...).submit is not a function
Thanks.
I want to send a POST parameter named submit through forms, how can this be done automatically?
myForm.submit is a reference to the text input with name="submit":
<input type="text" name="submit" value="Save" />
Change the name to something other than "submit".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With