function resetForm() {
  document.getElementById('myForm').reset();
}

<div id="myForm">
  <label class="form ">First name:</label><br/>
  <input type="text" id="Fname" name="first name"></input><span id="first"></span><br>
  <label class="form ">last name:</label><br>
  <input type="text" id="Lname" name="last name"></input><span id="last"></span><br>enter code here
  <label class="form"> address:</label><br>
  <input type="text" id="Address" name="address name"></input> <span id="add"></span><br>
  <label class="form"> email:</label><br>
  <input type="text" id="Email" name="email name"></input> <span id="ema"></span><br>
  <label class="form"> gender:</label><br>
  <input type="radio" class="Gend" id="Male" value="male" name="Gender"><b><i>Male</i></b></input>
  <input type="radio" class="Gend" id="Female" value="female" name="Gender"><b><i>Female</i></b></input><span id="Ge"></span><br>
  <label class="form">Phone number:</label><br>
  <input type="text" id="Phone" name="phone"></input><span id="ph"></span><br><br>
  <input type="button" class="button " value="Submit" onclick="myFun()"></input>
  <input type="button" class="button " name="Save" value="Save" onclick="savedRow()" /><br>
  <input type="reset" class="button" name="Reset" value="reset" onclick="resetForm()" />
</div>

最佳答案

我想你需要一张表格
不是
div
看看这个例子:
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_form_reset

关于javascript - 重置表格不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51175349/

10-13 01:47