Return to Snippet

Revision: 25000
at March 17, 2010 14:15 by frankyfish


Initial Code
function resetForm(formId) {
	jQuery("#"+formId+" :input").each(function(i, el) {
		if(el.defaultValue) {
			jQuery(el).val(el.defaultValue)
		} else {
			jQuery(el).val("")
		}
	})
	jQuery("#"+formId+" :checkbox").val([])
	jQuery("#"+formId+" :radio").val([])
}

Initial URL

                                

Initial Description
Function to reset a complete form to there default value.

Initial Title
jQuery Form Reset

Initial Tags
form, javascript, jquery

Initial Language
jQuery