Created
April 21, 2011 21:26
-
-
Save muloka/935527 to your computer and use it in GitHub Desktop.
clearing input fields w/o switch/case
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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