Skip to content

Instantly share code, notes, and snippets.

@muloka
Created April 21, 2011 21:26
Show Gist options
  • Save muloka/935527 to your computer and use it in GitHub Desktop.
Save muloka/935527 to your computer and use it in GitHub Desktop.
clearing input fields w/o switch/case
jQuery('#' + form_id).find(':input').each(function(i,e) {
// list of types to clear with default values
var obj = {
'text' : ''
, 'select-one': 0
};
if (obj[e.type] !== undefined) {
jQuery(e).val(obj[e.type]);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment