$.fn.clearForm = function() {
  $( this ).
    find( ':text, :password, textarea' ).
      attr( 'value', '' ).end().
    find( ':checkbox, :radio' ).
      attr( 'checked', false ).end().
    find( 'select' ).
      attr( 'selectedIndex', -1 );
}