Tag Description
The button tag is used to define a push button.
This tag has the form:
<button
name="string"
type="{ button | reset | submit }"
value="text">
</button>
HTML5 and HTML4.01 Differences
None.
HTML5 | = New for HTML5 |
Attributes
Attribute | Value | Description |
---|---|---|
autofocusHTML5 | autofocus | Makes the button focused on page load |
disabled | disabled | Specifies that the button should be disabled |
formHTML5 | form_id | Defines one ore more forms the button belongs to |
formactionHTML5 | URL | Specifies where to send the form-data when a form is submitted (overrides the form's action attribute) |
formenctypeHTML5 | application/x-www-form-urlencoded multipart/form-data text/plain |
Specifies how form-data should be encoded before sending it to a server (overrides the form's enctype attribute) |
formmethodHTML5 | get post put delete |
Specifies how to send form-data (overrides the form's action attribute) |
formnovalidateHTML5 | formnovalidate | If present, indicates that the form should not be validated when submitted (overrides the form's novalidate attribute) |
formtargetHTML5 | _blank _self _parent _top framename |
Specifies where to open the action URL (overrides the forms target attribute)
|
name | name | Specifies the name for the button |
type | button reset submit |
Specifies the type of the button |
value | text | Specifies the underlying value of the button |
Global Attributes
This tag also supports the HTML Global Attributes.
Event Attributes
This tag also supports the HTML Event Attributes.
Examples
The following example shows the basic use of this tag:
<button type="button">
Click this Button
</button>
This produces the following result:
Browser Support
Chrome | Firefox | IE | Safari | Opera |
---|---|---|---|---|
Doctype Declaration Support
The following table lists the doctype declarations this element may appear in:
HTML4.01 / XHTML1.0 | XHTML 1.1 | HTML 5 | ||
---|---|---|---|---|
Traditional | Strict | Frameset | ||
Miscellaneous Information
Defined In: | HTML4 |
---|---|
Empty Tag: | No |