Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

button

The <button> element is a multipurpose button component. Its type attribute determines its behavior. When it is interacted with you can perform any scripted task using JavaScript. Or use it in a form to reset or submit the form.

Code Example

<button type="button" onclick="alert('Thanks')">Click me</button> open in code editor

Attributes

globals - the global attributes common to all elements possible values: see global attribute list autofocus - makes the button automatically receive focus when the document loads possible values: "autofocus" disabled - disables the button possible values: "disabled" form - associate the button with a form element possible values: "form id" formaction - if button is type "submit" this specifies the parser URL possible values: "URL string" formenctype - if button is type "submit" this specifies the form encoding type possible values: "application/x-www-form-urlencoded", "multipart/form-data", "text/plain" formmethod - if button is type "submit" this specifies the form HTTP method possible values: "post", "get" formnovalidate - if button is type "submit" this disables validation of the form possible values: "formnovalidate" formtarget - browsing context name representing the target of the form control possible values: "_blank", "_self", "_parent", "_top" menu - associate a menu element with the button possible values: "menu id" name - the name part of the key-value pair (used for form submission) possible values: "variable name" type - specifies the button type possible values: "submit", "reset", "button" value - the value part of the key-value pair (used for form submission) possible values: "variable value"

Official Documentation

http://www.w3.org/TR/html/forms.html#the-button-element

HTML

Elements

aabbraddressareaasidearticleaudiobbasebdobdiblockquotebodybrbuttoncanvascaptioncitecodecolcolgroupdatadatalistdddeldetailsdfndialogdivdldtemembedfieldsetfigcaptionfigurefooterformh1 h2 h3 h4 h5 h6headheaderhrhtmliiframeimginputinskbdkeygenlabellegendlilinkmainmapmarkmetameternavnoscriptobjectoloptgroupoptionoutputpparampreprogressqrb rp rt rtc rubyssampscriptsectionselectsmallsourcespanstrongstylesub supsummarytabletbodytdtemplatetextareatfootththeadtimetitletrtrackuulvarvideowbr