HTML DOM Form reset () method
Definition and Usage
reset () method to reset the value of all the elements of the form (in accordance with one click Reset button effects).
grammar
formObject.reset()
Browser Support
All major browsers support reset () method
Examples
Examples
Create a form reset button:
<html>
<head>
<script>
function formReset()
{
document.getElementById("frm1").reset();
}
</script>
</head>
<body>
<form id="frm1">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="button" onclick="formReset()" value="Reset form">
</form>
</body>
</html>
<head>
<script>
function formReset()
{
document.getElementById("frm1").reset();
}
</script>
</head>
<body>
<form id="frm1">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="button" onclick="formReset()" value="Reset form">
</form>
</body>
</html>
try it"
Form Object