Button types
What are the HTML button types?
There are three values for type: submit, reset and button. A missing or misspelled type falls back to submit. Outside a form, submit and reset have nothing to act on, so the button only runs the JavaScript you attach.
| type | Inside a form | Use it for |
|---|---|---|
submit (the default) | Runs validation, then sends the form to its action. Enter in a text field also triggers the form's first submit button. | The main action: Send, Sign up, Pay. |
reset | Puts every field back to its value from the HTML, without asking first. | Rarely. People click it by mistake and lose what they typed. |
button | Nothing. No submit, no validation, no reload. | Script actions: open a dialog, add a row, show a password, preview. |
No type | Same as submit. | Avoid it: state the type so the button's job is clear. |
Sources: WHATWG HTML Standard: the button element · WHATWG HTML Standard: implicit submission · MDN: <button>

