<button>
The button element represents a clickable control that triggers an action.
Syntax
<button type="button">...</button> Examples
<button type="submit">Save</button>
<button type="button" onclick="open()">Open dialog</button>
Output
Renders two clickable buttons; the first submits its form, the second runs a script.
Notes
Inside a form the default type is "submit"; set type="button" to prevent accidental submission. Prefer <button> over a clickable <div> for built-in keyboard and accessibility support.
Browser & runtime support
| Environment | Since version |
|---|---|
| chrome | 1.0 |
| firefox | 1.0 |
| safari | 1.0 |
| edge | 12 |