Clear Values of All Form Elements Using jQuery

I always wanted to have one common function to reset all form elements. Please have a look at jQuery code that does the same thing. It finds out all element of form and loops over it and reset them. I hope this thing will be helpful specifically where there are many search fields and you need to reset them frequently.

function resetFormElements(frm){
$(frm).find(‘:input’).each(function() {
case ‘password’:
case ‘select-multiple’:
case ‘select-one’:
case ‘text’:
case ‘textarea’:
case ‘checkbox’:
case ‘radio’:
this.checked = false;

Note : I noticed that some time in IE selectbox is not getting cleared. So you can modify script and put [code:js]’$(this).attr("selectedIndex",0);'[/code] for ‘select-one’ case. It will work in both IE and mozilla.