HTML button Tag
HTML button Tag
The button tag defines a clickable button. Inside a button element, we can put text which will be displayed on the browser. We can also put elements like i, br, b, strong, img in it. However, we always need to specify the type of button element which helps browsers determine which type of button it is.
Attribute Eplanantion:-
Attribute | Value | Description |
---|---|---|
autofocus | autofocus | Specifies that button should automatically get focus when page loads |
disabled | disabled | Specifies that button should be disabled |
form | form_id | Specifies which form button belongs to |
formaction | URL | Specifies where to send form-data when form is submitted. Only works with type="submit" |
formenctype | application/x-www-form-urlencoded multipart/form-data text/plain |
Specifies how form-data should be encoded before sending it to server. Only works for type="submit" |
formmethod | get post |
Specifies how to send form-data. Only works for type="submit" |
formnovalidate | formnovalidate | Specifies that form-data should not be validated on submission. Only works for type="submit" |
formtarget | _blank _self _parent _top framename |
Specifies where to display response after submitting form. Only works for type="submit" |
name | name | Specifies name for button |
type | button reset submit |
Specifies type of button |
value | text | Specifies an initial value for button |
Syntax:-
Its syntax is:- < button >