Button does not submit form

Sometimes pressing button does not result in submitting form and calling handlers of the submit event.

Possible reasons:

  • the button has the type of button instead of submit;
  • the button is outside the form;
  • the form is invalid, but this is unnoticeable: the invalid field is hidden, or default styling (outline or box-shadow) for invalid fields (:invalid) is reset;
  • there was a JavaScript error either before submitting the form or in a handler of the submit event.