// jQuery Placeholder Enhanced 1.4 | by Denis Ciccale @tdecs | under the MIT license
(function(b){var d="placeholder"in document.createElement("input")&&"placeholder"in document.createElement("textarea"),c="placeholder",e;d||(e=b.fn.val,b.fn.val=function(){if(this.length){if(!arguments.length&&("INPUT"===this[0].nodeName||"TEXTAREA"===this[0].nodeName))return this[0].value===this.attr("placeholder")?"":this[0].value;this.hasClass(c)&&this.removeClass(c);return e.apply(this,arguments)}});b.fn.placeholderEnhanced=function(){function e(c){var d={};b.each(c.attributes,function(b,a){a.specified&&("placeholder"!==a.name&&"name"!==a.name)&&(d[a.name]=a.value)});return d}function h(b){b.css({position:"absolute",left:"-9999em"})}if(this.length)return d||b("form").submit(function(){b(this).find("input[placeholder], textarea[placeholder]").each(function(){!b(this).val()&&!this.disabled&&(this.value="")})}),this.each(function(){function k(){a.hasClass(c)&&(d||(f.value=""),a.removeClass(c))}function l(){a.val()||(d?a.addClass(c):i?(g.css({position:"",left:""}),h(a)):a.val(j).addClass(c))}if(!0!==b.data(this,"placeholderEnhanced")){var f=this,a=b(this),j=a.attr("placeholder"),i="password"===f.type,g;!i||d?a.bind("focus.placeholder",k):(g=b("<input>",b.extend(e(f),{type:"text",value:j,tabindex:-1})).addClass(c).bind("focus.placeholder",function(){a.trigger("focus.placeholder")}).insertBefore(a),a.bind("focus.placeholder",function(){a.css({position:"",left:""});h(g)}));a.bind("blur.placeholder",l).trigger("blur.placeholder");b.data(f,"placeholderEnhanced",!0)}})};b(function(){b("input[placeholder], textarea[placeholder]").placeholderEnhanced()})})(jQuery);
// jQuery Placeholder Enhanced 1.4 | by Denis Ciccale @tdecs | under the MIT license
(function(a){var d="placeholder"in document.createElement("input")&&"placeholder"in document.createElement("textarea"),c="placeholder",e;d||(e=a.fn.val,a.fn.val=function(){if(this.length){if(!arguments.length&&("INPUT"===this[0].nodeName||"TEXTAREA"===this[0].nodeName))return this[0].value===this.attr("placeholder")?"":this[0].value;this.hasClass(c)&&this.removeClass(c);return e.apply(this,arguments)}});a.fn.placeholderEnhanced=function(){function e(c){var d={};a.each(c.attributes,function(a,b){b.specified&&("placeholder"!==b.name&&"name"!==b.name)&&(d[b.name]=b.value)});return d}function h(a){a.css({position:"absolute",left:"-9999em"})}if(this.length)return d||a("form").filter(function(){return!a.data(this,"placeholderEnhanced")}).each(function(){a(this).bind("submit.placeholder",function(){a(this).find("input[placeholder], textarea[placeholder]").each(function(){!a(this).val()&&!this.disabled&&(this.value="")})});a.data(this,"placeholderEnhanced",!0)}),this.each(function(){function k(){b.hasClass(c)&&(d||(f.value=""),b.removeClass(c))}function l(){b.val()||(d?b.addClass(c):i?(g.css({position:"",left:""}),h(b)):b.val(j).addClass(c))}if(!0!==a.data(this,"placeholderEnhanced")){var f=this,b=a(this),j=b.attr("placeholder"),i="password"===f.type,g;!i||d?b.bind("focus.placeholder",k):(g=a("<input>",a.extend(e(f),{type:"text",value:j,tabindex:-1})).addClass(c).bind("focus.placeholder",function(){b.trigger("focus.placeholder")}).insertBefore(b),b.bind("focus.placeholder",function(){b.css({position:"",left:""});h(g)}));b.bind("blur.placeholder",l).trigger("blur.placeholder");a.data(f,"placeholderEnhanced",!0)}})};a(function(){a("input[placeholder], textarea[placeholder]").placeholderEnhanced()})})(jQuery);
update min version