Javascript examples for DOM HTML Element:Form
The reset() method resets the values of all elements in a form.
The following code shows how to Reset a form:
<!DOCTYPE html> <html> <body> <form id="myForm"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br><br> <input type="button" onclick="myFunction()" value="Reset form"> </form>/*from w w w . j av a2 s . c o m*/ <script> function myFunction() { document.getElementById("myForm").reset(); } </script> </body> </html>