HTML - Button Tag



The HTML <button> tag is used for creating a button within HTML form. You can also use <input> tag to create similar buttons.


<!DOCTYPE html>

      <title>HTML Button Tag</title>

         <button name = "button" value = "OK" type = "button">Click Me</button>


This will produce the following result −

Global Attributes

This tag supports all the global attributes described in HTML Attribute Reference

Specific Attributes

The HTML <button> tag also supports the following additional attributes −

Attribute Value Description
autofocus html-5 autofocus Specifies that the button should have input focus when the page loads.
disabledhtml-5 disabled Specifies the button is disabled.
form html-5 form_id Specifies the forms to which button belongs.
formaction html-5 URL Specifies the link where the form submits.
formenctype html-5 application
Specifies how the form data is encoded before sending it to server.
formmethod html-5 get
Specifies how to send form data.
formnovalidatehtml-5 formnovalidate Specifies that the form data should not be validated.
formtarget html-5 _blank
Specifies where the response should be validated.
name name Specifies the button name.
type button
Specifies the button type.
value text Specifies button's initial value.

Event Attributes

This tag supports all the event attributes described in HTML Events Reference

Browser Support

Chrome Firefox IE Opera Safari
Yes Yes Yes Yes Yes