During development, we will use many forms. We hope that the form can be reset after it is submitted.
But jquery does not have this method. How to deal with it?
Method 1:
We can implement
id:
document.getElementById("form1").reset();
name:
document.formName.reset();
Method 2:
Clear one by one:
$("#inp").val("1");
But if there are too many forms, this is not practical. There are 100 or 1000. You can’t write 100 or 1000.
Maybe you will say, write it like this:
$ ("input").val("");
What about the default value of the form? There are other types of forms, write them all?
Add input of type reset
$("input[name='res']").click();
Clear all forms
ok