var elem = document.getElementById('myForm');
var event = new Event('submit');
Now why is this better than using addEventListener, or the .onsubmit property?
From what I can see of how it works you'd use that when you want to trigger the event without any intervention by the person visiting the page.
For example you could put that code in a function and trigger it using a setTimeout to submit the form after a specific time regardless of whether the person has started filling out the form or is part way through. A simple way to limit the amount of time allowed for entering info in the form because it gets submitted automatically by that code if the person hasn't already triggered the listener or handler directly..
This topic is now closed. New replies are no longer allowed.