Menu
Forms & Inputs

<button> Tag

Submit forms or trigger JavaScript actions.

1Pick a Type

type="submit" submits the parent form, type="reset" clears it, type="button" does nothing by default — wire it up with JavaScript. Always set a type to avoid surprises.

Example Code
<button type="submit">Save</button>
<button type="reset">Clear</button>
<button type="button" onclick="openModal()">Open modal</button>

<button type="submit" disabled>Submitting…</button>

Finished reading?

Mark this topic as complete to track progress.