How To Reset An HTML Form With JavaScript

With HTML, a reset button can be added in a form with <input /> tag. For that, we need to specify an attribute type with "reset" value as type="reset"

<input type="reset" value="Reset" />

And when the user clicks on the Reset button, the form that it belongs to will reset to its original state.

This can also be done with JavaScript by using reset() method.

In this tutorial, we’ll see how to reset an HTML form with JavaScript.


  • Assume that we have an E-commerce website containing login and registration form on the same page like Facebook.
  • An HTML form for registration with id registrationForm which will be used by a new customer coming to our website.
<form action="" method="post" id="registrationForm">
  <!-- .... -->

So in order to reset this form we will use JavaScript reset() method.

const registrationForm = document.getElementById("registrationForm");

With method chaining


This will restore the form to its original state by clearing all the form elements.

“Talk is cheap. Show me the code.”
~ Linus Torvalds

Happy 😄 coding

Vishnu Damwala
Vishnu Damwala

A web geek, an industry experienced web developer & tutor/instructor residing in India 🇮🇳