Button does not submit form
- Published:
Sometimes pressing a button does not result in submitting the form and calling JavaScript handlers of the submit event of the form.
Possible reasons:
- the button has
buttoninstead ofsubmitas its type (the value of thetypeattribute); - 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
outlineorbox-shadowproperty) for invalid elements (the:invalidpseudoclass) is reset;
- there was a JavaScript error either before submitting the form or in a handler of the
submitevent.