<button> tag in HTML
The <button> tag is used to defines a clickable button but in HTML form, different browsers may submit different values for example use <input> to create buttons in an HTML form.
Important Description
- Put content like <img> tag or text, inside a <button> element & make it clickable.
- Always specify the type attribute for a <button> element.
Example of <button> tag
Result Look Like
<button> Tag Browser Support
Element |
Chrome |
Edge |
Firefox |
Safari |
Opera |
<button> |
Yes |
Yes |
Yes |
Yes |
Yes |
Global Attributes
Event Attributes
Attributes
Attribute |
Value |
Description |
autofocus |
autofocus |
Defines that a button should automatically gives focus to this control when the page loads. |
disabled |
disabled |
Defines that a button should be disabled |
form |
form_id |
Defines one or more forms the button belongs to |
formaction |
URL |
Defines the URL of the file that will process the control when submitted. |
formenctype |
multipart/form-data
text/plain |
Defines how form-data should be encoded before sending it to a server when submitted. |
formmethod |
get
post |
Defines how to send the form-data when submitted |
formnovalidate |
formnovalidate |
Defines the form-data should not be validated on submission. |
formtarget |
_blank
_self
_parent
_top
_framename |
Defines where to display the response after submitting the form. |
name |
name |
Defines a name for the button |
type |
button
reset
submit |
Defines the type of button |
value |
text |
Defines an initial value for the button |