There are three types of type for a button element, thought they’re all displayed in exactly the same way by the browser:
- type=submit: Used to submit a form.
- type=reset: Used to reset a form.
- type=button: Used as a general button control (does nothing by default).
Example
Syntax
1 | |
2 | |
3 | |
4 | |
5 |
Result
Browser Support
Attributes
The
The
- type: Type of button – submit, reset, button
- value: Value to be used for form submission
- disabled: Whether the form control is disabled
- form: Associates the element with a form element
- formaction: URL to use for form submission
- forenctype: Entry list encoding type to use for form submission
- formmethod: Variant to use for form submission
- formnovalidate: Bypass form control validation for form submission
- formtarget: Navigable for form submission
- name: Name of the element to use for form submission and in the form.elements API
Content
A
,
etc.) can be contained within them. ::after and ::before pseudo-elements can be used on them via CSS too.
In the example below you can see
Syntax
1 | |
2 | |
3 | Button label |
4 |
Result
Learn More
Did you know by using the form=”” attribute on a