Sometimes, we want to reset (clear) form through JavaScript.
In this article, we’ll look at how to reset (clear) form through JavaScript.
How to reset (clear) form through JavaScript?
To reset (clear) form through JavaScript, we call the form element’s reset
method.
For instance, we write
document.forms["frm_id"].reset();
to get the form with ID frm_id
with document.forms["frm_id"]
.
Then we call reset
to clear the values in the form.
Conclusion
To reset (clear) form through JavaScript, we call the form element’s reset
method.