WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML <button> Tag


Example

The following code marks a button:

<button type="button">Click Me!</button>
Try it yourself »

Definition and Usage

<button> The label defines a button.

in <button> Inside the element, you can place content such as text or images. This is the element to useInside the element, you can place content such as text or images. This is the element to use<input> The difference between the buttons created by the element.

Tip: Please always <button> The element specifies a type attribute. Different browser pairs <button> The element's type attribute uses different default values.


Browser Support

Element
<button> Yes Yes Yes Yes Yes Yes

Differences Between HTML 4.01 and HTML5

HTML5 has the following new attributes: autofocus, form, formaction, formenctype, formmethod, formnovalidate, and formtarget.


Attributes

= New in HTML5.

Attribute value Description
autofocus autofocus specifies that the button should automatically get focus when the page loads.
disabled disabled specifies that the button should be disabled.
form form_id Specifies that the button belongs to one or more forms.
formaction URL Specifies where to send form data when submitting the form. Override the action attribute of the form element. This attribute is used in conjunction with type = "submit".
formenctype application /x-www-form-urlencoded
multipart /form-data
text /plain
Specifies how to encode form data before sending it to the server. Override the enctype attribute of the form element. This attribute is used in conjunction with type = "submit".
formmethod get
post
Specifies the HTTP method used to send form data. Override the method attribute of the form element. This attribute is used in conjunction with type = "submit".
formnovalidate formnovalidate If this attribute is used, no validation is performed when the form is submitted. Override the novalidate attribute of the form element. This attribute is used in conjunction with type = "submit".
formtarget _blank
_self
_parent
_top
framename
Specifies where to open the action URL. Override the target attribute of the form element. This attribute is used in conjunction with type = "submit".
name name Specifies the name of the button.
type button
reset
submit 
Specifies the type of button.
value text specifies the initial value of the button. Can be modified by script.