Reset Button in a Form
In HTML, reset button is an input element that is used to reset all the fields of a form to their default values.
When a user clicks the reset button, it will reset all the form input elements (fields) back to their default values.
How to Create a Reset Button
Create an HTML <input>
element inside an HTML form element.
Add type="reset"
(type attribute with value 'reset') to the <input>
element. Type attribute value is set to 'reset' to define the input element as a Reset button.
Add value="Reset"
(value attribute with value 'reset') to the <input>
element. The value attribute here sets the display value of the Reset button.
A label ( <label>First Name:</label>
) and a textbox ( <input type="text" placeholder="Type your name here" />
) have been added before the Reset button.
Have a look at the following example:
Example of Reset Button in a Form
Output of the above code example
Example of Reset Button in a Form in an HTML Page
Write your name in the above textbox and click the reset button to see the reset effect.