paul_wilkins — 2013-06-06T02:24:34-04:00 — #1
var elem = document.getElementById('myForm');
var event = new Event('submit');
Now why is this better than using addEventListener, or the .onsubmit property?
felgall — 2013-06-06T03:13:45-04:00 — #2
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..