How to reset a form with JavaScript

In this tutorial you will learn how to reset a form with JavaScript using the reset() method, as shown in the example below:

How to reset a form with JavaScript
<!DOCTYPE html>
		<title>Reset a form</title>
		   function resetForm() {
		<form action="run.php" method="post" id="frm">
			<p><label>Firstname:</label> <input type="text" name="firstname"></p>
			<p><label>Lastname:</label> <input type="text" name="lastname"></p>
			<p><label>Address:</label> <input type="text" name="address"></p>
		<button type="button" onclick="resetForm();">Reset the form</button>
Reset the form

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *