/* * Textfocus v1.0 - Default message for text HTML elements * Copyright (c) 2010 Boyan Mihaylov * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * */ (function($) { $.fn.textfocus = function(message) { this.each(function() { $(this).val(message); }); this.focus(function() { var value = $(this).val(); if(value==message){ $(this).val('');} }); this.blur(function() { var value = $(this).val(); if(value==''){ $(this).val(message);} }); return this; }; })(jQuery);