There are several text entry fields, several checkboxes and one drop-down list inside the form. They need to be cleared and set to default values ​​through a script, which is called by pressing a single button. The reset method for the form does not offer.

  • And why not offer it? - Qwertiy

2 answers 2

Well, if not the reset method, then:

<input type="reset"> 

The same, but without javascript.

  • I'm sorry. Just <input type = "reset"> I do not need. - nimak
  • one
    Then <input type="button" onclick="this.form.reset()"> . If the default values ​​are set by the script, then I can also write a way. - ling
 var forms = document.querySelectorAll('input'); for (var i in forms) { forms[i].value = ""; } 
  • Add a solution to your answer to make it easier for users to understand your code. - Yuri