The <button>
element
A button which can be part of a form.
Full list of attributes
All the usual HTML global attributes are available
autofocus
- Makes this button the default focused element on the page.
disabled
- The button will be disabled if this attribute is present. It will not respond to clicks and will not contribute a value to the form data when the form is submitted.
form
- Sets the ID of the
<form>
element which this button will be associated with. The default is just to use the element it's inside of. formaction
- Overrides the
action
attribute on the form's<form>
element. formenctype
- Overrides the
enctype
attribute on the form's<form>
element. formmethod
- Overrides the
method
attribute on the form's<form>
element. formnovalidate
- Overrides the
novalidate
attribute on the form's<form>
element. formtarget
- Overrides the
target
attribute on the form's<form>
element. menu
- The ID of a
<menu>
element defining the popup menu to show when thetype
attribute is set tomenu
. name
- The name which will be used for any value generated by the button when the form is submitted.
type
- What the button should do when it's pressed. Must be either
submit
,reset
,button
, ormenu
. If it'sbutton
then it won't actually do anything unless JavaScript code is used to give it some functionality. value
- The text that should be included with the form submission for this element.