HTML <button> Tag with the 'type' Attribute
<form>
<input>
<button type="reset">Reset</button>
</form>
<p>Type something then click the 'Reset' button.</p>
In the above example we add the type
attribute to a button control.
About the type
Attribute
The type
attribute allows you to specify the type of button.
Possible values:
submit
- Submits the form. This is the default value.
reset
- Resets the form.
button
- Does nothing. You can use JavaScript to make the control actually do something.
menu
- Displays a menu. When using this value, you must specify the menu using the
menu
attribute (see above).
About the <button>
Element
The <button>
element creates a button control in an HTML document.
Any contents of the <button>
element appears on the button.
The <button>
element can be associated with a form or stand alone by itself (in such case it could have JavaScript attached via the onclick
attribute) to make the button actually do something.