I have a form with a standard reset button coded thusly:
Trouble i
jQuery Plugin
I created a jQuery plugin so I can use it easily anywhere I need it:
jQuery.fn.clear = function()
{
var $form = $(this);
$form.find('input:text, input:password, input:file, textarea').val('');
$form.find('select option:selected').removeAttr('selected');
$form.find('input:checkbox, input:radio').removeAttr('checked');
return this;
};
So now I can use it by calling:
$('#my-form').clear();