Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reset a form to the default values

Currently I have:

$("#your_email").val(this.defaultValue;)

I want to be cycling through all form elements and resetting them to their default value

like image 207
kalpaitch Avatar asked Aug 31 '10 15:08

kalpaitch


1 Answers

you don't need jQuery for this, just get the form dom element and call reset() on it.

Or, fetch with jQuery like:

$("#myFormId")[0].reset();
like image 93
brad Avatar answered Sep 18 '22 12:09

brad