I want to be able to submit a form after a page loads automatically through Javascript.
I am writing a google chrome extension.
So far the extension can fill in text in the input boxes but I can't figure out a way to get to the next step where the user would click Submit. Please help. Thank you.
EDIT: Pardon my edit. It wasn't clear that he was writing a chrome extension to those of us in the chatroom. --drachenstern
Did you try something like document.getElementById('myForm').submit()
?
With a form like (after EDIT):
<form id="myform" action="/url/To/Action">
...
</form>
...
<script>
document.getElementById('myForm').submit();
</script>
EDIT after your comment:
The script
tag must be after the form
tag. Or at the very end of the body
tag if you want to be sure all the DOM elements are loaded.
Try document.getElementById('form1').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