HTML 5 <button> Tag
Example
A button is marked up as follows:
| <button type="button">Click Me!</button> |
Try it yourself » |
Definition and Usage
The <button> tag defines a push button.
Inside a button element you can put content, like text or images. This is the difference between this element and buttons created with the input element.
Always specify the type attribute for the button. Different browsers uses
different default values for the type attribute.
Differences Between HTML 4.01 and HTML 5
HTML 5 has new attributes: autofocus,form,
formaction,
formenctype,
formmethod,
formnovalidate, and
formtarget.
Tips and Notes
Note: if you use the button element in an HTML form, different
browsers submit different button values. Use the input element to create buttons
in an HTML form.
Attributes
| Attribute |
Value |
Description |
| autofocus |
sutofocus |
Makes the button focused or not, as the page loads |
| disabled |
disabled |
Disables the button |
| form |
form_name |
Specifies which form this button belongs to |
| formaction |
url |
Specifies where to send the form-data when a form is
submitted. Overrides the forms action attribute. |
| formenctype |
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 forms action attribute. |
| formmethod |
delete get post put |
Specifies how to send form-data. Overrides the forms action attribute. |
| formnovalidate |
formnovalidate |
If present, indicates that the form should not be validated when submitted. Overrides the forms action attribute. |
| formtarget |
_blank
_self
_parent
_top
framename |
Specifies where to open the action URL. Overrides the forms action attribute. |
| name |
button_name |
Specifies a unique name for the button |
| type |
button
reset
submit |
Defines the type of button |
| value |
some_value |
Specifies an initial value for the button. The value can be
changed by a script |
Standard Attributes
| class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title |
For a full description, go to Standard Attributes in HTML 5.
Event Attributes
| onabort, onbeforeunload, onblur, onchange, onclick,
oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave,
ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress,
onkeyup, onload, onmessage, onmousedown, onmousemove,
onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect,
onsubmit, onunload |
For a full description, go to Event Attributes in HTML 5.

Whether you're new to XML or already an advanced user,
the user-friendly views and powerful entry helpers,
wizards, and debuggers in XMLSpy are designed to meet your XML
and Web development needs from start to finish.
New features in Version 2010!
- XML editor
- Graphical XML Schema / DTD editors
- XSLT 1.0/2.0 editor, debugger, profiler
- XQuery editor, debugger, profiler
- XBRL validator, taxonomy editor, taxonomy wizard
- Support for Office Open XML (OOXML)
- Graphical WSDL 1.1/2.0 editor & SOAP debugger
- JSON editing & conversion
- Java, C#, C++ code generation
- And much more!
Download a free trial today!
|
|
|
|