To clear all the input in an HTML form, use the <input> tag with the type attribute as reset.
JQuery doesn't have a reset() method, but native JavaScript does. So, we convert the jQuery element to a JavaScript object. JavaScript reset(): The reset() method resets the values of all elements in a form (same as clicking the Reset button).
The HTMLFormElement. reset() method restores a form element's default values. This method does the same thing as clicking the form's <input type="reset"> control. If a form control (such as a reset button) has a name or id of reset it will mask the form's reset method.
Definition and Usage. The :reset selector selects button and input elements with type=reset. Tip: Using input:reset as a selector will not select the button element.
I need to reset forms elements after click span for example.
Is there a method to reset the from by jQuery without select each element and remove the attribute value.
Some of the elements not having attribute value like textarea or radio
And some like button I don't want to remove the value from it.
I want use jQuery to use the reset on other events
Code for example http://jsfiddle.net/pgNrF/
<input type="button" value="Input Button">
<input type="checkbox">
<input type="hidden">
<textarea></textarea>
<span>Reset</span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With