Form submit event not firing

Consider the following code:

form.addEventListener('submit', function(e) {
    console.log(e);
    debugger;
});

If none of the above trigger, this may be because you're submitting the form via the javascript submit() method, which circumvents the event. From the MDN documentation:

No submit event is raised. In particular, the form's onsubmit event handler is not run.

Use requestSubmit() instead.

Leave a comment