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 button instead of submit as its type (the value of the type attribute);
  • the button is outside of the form;
  • the form is invalid, but this is unnoticeable: the invalid form element is hidden, or default styling (the outline or box-shadow property) for invalid elements (the :invalid pseudo­class) is reset;
  • there was a JavaScript error either before submitting the form or in a handler of the submit event.