How to use Form reset in JavaScript
This article describe about Form reset() Method in JavaScript.
Form reset() Method
It is used to resets the values of all elements in a form ( just like clicking the Reset button ).
Syntax
Example
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function formReset() {
document.getElementById("form1").reset();
}
</script>
</head>
<body>
<p>Enter some text in the fields below, then press the "Reset form" button to reset the form.</p>
<form id="form1">
Enter First name: <input type="text" name="fname" /><br />
Enter Last name: <input type="text" name="lname" /><br /><br />
<input type="button" onclick="formReset()" value="Reset form" />
</form>
</body>
</html>
|
Output
You may also want to read these related articles Click here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here