Revision: 29549
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 31, 2010 10:46 by terrencewood
Initial Code
/** * Remove and restore the defaultValue from a text input or textarea if it is unchanged. */ (function ($) { $.fn.defaultvalue = function () { var els = $(this).filter("textarea,input[type=text]"); return els.each(function () { var el = $(this); var dv = el.attr("defaultValue"); el.focus(function () { if (el.attr("value") == dv) { el.attr("value", "") } }).blur(function () { if (el.attr("value") == "") { el.attr("value", dv) } }) }) } })(jQuery);
Initial URL
Initial Description
Initial Title
jquery.defaultvalue
Initial Tags
jquery
Initial Language
JavaScript