(function($) {
  $.fn.def = function() {
  return this.each(function(){
    if($(this).is('input, textarea') && '' != this.value) {
      this.def = this.value;
      $(this).bind('focus', function(){
        if(this.value == this.def) {
          this.select();
        }
      });
      $(this).bind('blur', function(){
        if(this.value == '') {
          this.value = this.def;
        }
      });
    }
  });
  };
})(jQuery);