How to create a reset button for a form in an HTML page

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.

Live Code Playground

In the following HTML code editor, you can practice the above code by creating new form elements and reset buttons. Click on the 'Run Code' button to render the code; the rendered page will be displayed in the following HTML Code Output frame. Practice until you become comfortable and proficient with your code.

HTML logo HTML Online Editor
HTML Code Output