Skip to content

Instantly share code, notes, and snippets.

@thePunderWoman
Created February 11, 2013 18:41
Show Gist options
  • Save thePunderWoman/4756545 to your computer and use it in GitHub Desktop.
Save thePunderWoman/4756545 to your computer and use it in GitHub Desktop.
Jquery Clear Form
clearForm = function (idstr) {
var fields = $(idstr).find("input:not([type=hidden]):not([type=submit]):not([type=reset])");
$(fields).each(function (i, obj) {
if ($(obj).attr('type') == 'checkbox') {
$(obj).attr('checked', $(obj).data('default') == 'checked')
} else {
$(obj).attr('value', $(obj).data('default'));
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment