(function($){ $.fn.text_input = function(options) { var defaults = { }; var options = $.extend({}, defaults, options); //---------- Add 'text' class $(this).addClass('text'); //---------- Clear and re-add default value return this.each(function() { var default_value = $(this).attr('title'); if (options.not instanceof Array) { for (var $i = 0; $i <= options.not.length; $i++) { if(options.not[$i] == this.name) $(this).addClass('ignore'); } } else { if(this.name == options.not) $(this).addClass('ignore'); } $(this).focus(function() { if( (this.value == default_value) && ($(this).hasClass('ignore') == false) ) this.value = ''; }); $(this).blur(function() { if(this.value == '') this.value = default_value; }); }); } })(jQuery);