HTML <button> Tag


A clickable button is represented by the button tag. This tag is also referred to as the <button> element.

Text (including tags like <b>, <strong>, <br>, <img>, and so on) can be placed within a <button> element. That is not feasible with an <input> element-created button!

Always include the type property with a <button> element to notify browsers what sort of button it is.

Syntax

Example

Preview

Attributes

Attribute Value Description
autofocus autofocus Whether or whether the button should have input focus when the page loads, unless the user overrides it.
disabled disabled A Boolean value that indicates that the user is unable to interact with the button.
form form-id The form that owns the button is indicated by the value. In the same text, it is the Id of a.
formaction URL When a form is submitted, this property specifies where the form-data should be sent. Only when type="submit" is used.
formenctype application/x-www-form-urlencoded  
multipart/form-data  
text/plain
The Uniform Resource Identifier (URI) of an application that will handle the information supplied by the button.
formmethod get  
post
The type of material used to send the form to the server.
formnovalidate formnovalidate When the form is submitted, this value indicates that it will not be approved.
formtarget _blank  
_self  
_parent  
_top  
framename
Name or keyword specifying where the response should be displayed after submitting the form.
name name The button's name
type button  
reset  
submit
The button's style.
value text The button's initial value

Supported Browsers

Element Chrome Firefox Safari Edge / IE Opera
<button> Yes Yes Yes Yes Yes