// be sure to include the jquery library first
// this prototypes a function "clearForm" onto any element. 
// sample usage: $('table.inputForm').clearForm();
$.fn.clearForm = function() {
    return this.each(function() {
        var type = this.type, tag = this.tagName.toLowerCase();
  
        if (type == 'text' || type == 'password' || tag == 'textarea')
            this.value = '';
        else if (type == 'checkbox' || type == 'radio')
            this.checked = false;
        else if (tag == 'select')
            this.selectedIndex = -1;
        else
            return $(':input', this).clearForm();
    });
}
