Advertisement
julong

reset from #jquery

Oct 6th, 2014
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. reset form
  2. /////////////////////////////////////////////////////////////////
  3. /////////////////////////////////////////////////////////////////
  4. function resetForm($form) {
  5. $form.find('input:text, input:password, input:file, select, textarea').val('');
  6. $form.find('input:radio, input:checkbox')
  7. .removeAttr('checked').removeAttr('selected');
  8. }
  9.  
  10. // to call, use:
  11. resetForm($('#myform')); // by id, recommended
  12. resetForm($('form[name=myName]')); // by name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement