HTML <button> tag

You are Here:

HTML <button> tag

The <button> tag is used to create a clickable HTML button.

Any text appearing between the opening and closing tags will appear as text on the button.

By default, no action will take place when a button is clicked.

Use JavaScript to perform action when a button is clicked.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <button type="button">Click</button> </body> </html>

Attributes

The following are the attributes of <button> tag. Also try Global attributes.

AttributeValueExplanation
autofocus-Specifies that a button should automatically focus when the page loads.
disabled-Specifies that a button should be disabled.
formform_idSpecifies that a button belongs to which form.
formactionURLSpecifies a URL to send a form data when the user clicks the submit button.
formenctype
  • application/x-www-form-urlencoded
  • multipart/form-data
  • text-plain
Specifies how to encode a form-data before sending it to a server.
formmethod
  • get
  • post
If the button is a submit button, this attribute specifies the HTTP method that the browser uses to submit the form.
formnovalidate-Specifies the form should not be validated when the user clicks on the submit button.
formtarget
  • _blank
  • _self
  • _parent
  • _top
Specifies where to display the response after submitting the form.
namenameSpecifies a name for the button.
type
  • button
  • reset
  • submit
Specifies the type of the button.
valuetextSpecifies the initial value for the button.

Reminder

Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in HTML.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author