HTML Buttons Example
HTML Buttons :
There are two basic ways of creating an HTML button; with the <button> tag, and with the <input> tag.
This page provides code for both methods. The <button> element is used to create an HTML button. Any text appearing between the opening and closing tags will appear as text on the button.
No action takes place by default when a button is clicked. Actions must be added to buttons using JavaScript or by associating the button with a form.
The <button> tag is used to create clickable buttons on the web page. The difference between these elements and buttons created with the <input> tag is that you can place the content (images or text) inside the <button>.
Button Example :
Attributes of HTML Button Tag
Attribute | Description |
---|---|
autofocus | It specifies that a button should automatically get focus while the loading of the page. |
disabled | It specifies that a button shuld be disabled. |
form | It specifies one or more forms that the button belongs to. |
formaction | It is used for submit type. It specifies where to send the form data when form is submitted. |
formmethod | It specifies how to send form-data. |
formenctype | It specifies how form-data should be encoded before sending it to server. |
formnovalidate | It specifies that the form data should not be validated on submission. |
formtarget | It specifies that where to display the response after submitting the form. |
name | It specifies the name of the button. |
type | It specifies the type of the button. |
value | It specifies the value of the button. |