HTML · Forms and controls

button

A clickable control. Set type explicitly: submit inside a form, button everywhere else.

Syntax
<button type="button">…</button>

Example

Try it

Notes

Use a button for actions and a link for navigation. A div with a click handler is not a button.

More in this group

datalist fieldset form input input types label legend meter

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course