HTML <button> tag
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.
Attribute | Value | Explanation |
---|---|---|
autofocus | - | Specifies that a button should automatically focus when the page loads. |
disabled | - | Specifies that a button should be disabled. |
form | form_id | Specifies that a button belongs to which form. |
formaction | URL | Specifies a URL to send a form data when the user clicks the submit button. |
formenctype |
| Specifies how to encode a form-data before sending it to a server. |
formmethod |
| 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 |
| Specifies where to display the response after submitting the form. |
name | name | Specifies a name for the button. |
type |
| Specifies the type of the button. |
value | text | Specifies 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.