HTML input type reset Tutorial

In this section, we will learn what the input type reset is and how to use it.

HTML Reset Button: hat is input type reset in HTML?

The <input> element of type `reset` creates a button in a document that could be used to reset the content of a form.

When we say reset, that means, if the fields of a form are filled with data, clicking the reset button will remove all those data as if nothing were inserted into the form.

We usually use the reset type in the body of an HTML <form> element or use the `form` attribute in that input element to link it to a form.

HTML input type reset Syntax:

<input type = “reset”>

HTML input type reset Values

Using the reset value for the type attribute will create a button in a document. The only value we need to set is for the `value` attribute. This value will then appear on top of the target button to describe what the button does.

Example: Reset Form in HTML

See the Pen Reset Form in HTML by Omid Dehghan (@odehghan) on CodePen.

In this example, first fill the username and password fields and then hit the reset button. You’ll see all the values are gone afterwards.

Leave a Reply