I am using the following code to submit to a form:
element.dispatchEvent(new Event("submit"));
Inspector returns the error: Object doesn't support this action
This works in Chrome.
The purpose of this command is to make a division call the submit event on a form when clicked.
Jquery is not an option
This is the best way to make it work for IE11 and other browsers with considering future changes.
var event;
if(typeof(Event) === 'function') {
event = new Event('submit');
}else{
event = document.createEvent('Event');
event.initEvent('submit', true, true);
}
$el.dispatchEvent(event);