Form reset() Method - Javascript DOM HTML Element

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:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<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*/

function myFunction() {


Related Tutorials