Reset form with jQuery

Posted by da5id on Stack Overflow See other posts from Stack Overflow or by da5id
Published on 2009-03-25T04:40:59Z Indexed on 2010/04/28 3:13 UTC
Read the original article Hit count: 327

Filed under:
|
|

I have a form with a standard reset button coded thusly:

<input type="reset" class="button standard" value="Clear" />

Trouble is, said form is of the multi-stage sort, so if a user fills out a stage & then returns later, the 'remembered' values for the various fields won't reset when the Clear button is clicked.

I'm thinking that attaching a jQuery function to loop over all the fields and clear them 'manually' would do the trick. I'm already using jQuery within the form, but am only just getting up to speed & so am not sure how to go about this, other than individually referencing each field by ID, which doesn't seem very efficient.

TIA for any help.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about forms