Button does not submit form

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

Possible reasons:

  • the button has the type (the value of the type attribute) of button instead of submit;
  • the button is outside of 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.