HTML <button> tag
The <button> tag displays a button. Not to be confused with the <input> tag which also creates a button when its type attribute is set to "button". The difference between the two tags is that you can put content like text and images inside a <button> tag, while with buttons created using the <input> tag you can only put text.
Attributes
| Attribute | Possible values | Description |
|---|---|---|
| disabled | disabled | Makes the button disabled (unclickable) |
| name | buttonName | Sets the name of the button |
| type | button, reset, submit | Sets what type of button it is |
| value | btnValue | Sets the button value. Not to be confused with the actual text that appears on the button. Actual text that appears on the button should be set between the <button> and </button> tags. |
Standard attributes
accesskey, class, dir, id, lang, style, tabindex, title, xml:lang
For more information on standard attributes, check out our HTML standard attributes reference page.
Event attributes
onblur, onclick, ondblclick, onfocus, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onkeydown, onkeypress, onkeyup
For more information on event attributes, check out our HTML event attributes reference page.
Example
Tips & notes
It is better to use the HTML <input> tag to create buttons. The <input> tag is standard, while the <button> tag is rarely used.