Button Element

The <button> element creates a clickable button. Inside a form it can submit or reset the form, and anywhere on a page it can trigger JavaScript actions.

Web

Set type="submit" to send a form, type="reset" to clear it, or type="button" for a plain button with no default behavior (commonly used with JavaScript).

Prefer a real <button> over a styled <div> for clickable actions — buttons are keyboard-accessible and announced correctly by screen readers.

Examples

HTML

<button type="button" onclick="alert('Hi!')">Click me</button>

Output:

Renders a clickable button labeled 'Click me' that shows an alert saying 'Hi!'.

Learn it in a lesson

See also

Back to the Dictionary