Committer: pkornilov
LJSUP-7733: Cannot Recommend new post.U trunk/htdocs/js/jquery_fn.js
Modified: trunk/htdocs/js/jquery_fn.js =================================================================== --- trunk/htdocs/js/jquery_fn.js 2011-01-19 09:03:49 UTC (rev 18055) +++ trunk/htdocs/js/jquery_fn.js 2011-01-19 09:20:17 UTC (rev 18056) @@ -84,17 +84,21 @@ return this.each(function() { if (this.getAttribute("placeholder")) { var $this = jQuery(this); + + if (!$this.data('jQuery-has-placeholder')) { + $this.focus(check_focus).blur(check_blur); - $this.focus(check_focus).blur(check_blur); + jQuery(this.form) + .submit(function() { + $this.hasClass("placeholder") && $this.removeClass("placeholder").val(""); + }); + } - jQuery(this.form) - .submit(function() { - $this.hasClass("placeholder") && $this.removeClass("placeholder").val(""); - }); - this.value === this.getAttribute("placeholder") || !this.value ? $this.val(this.getAttribute("placeholder")).addClass("placeholder") : $this.removeClass("placeholder"); + + $this.data('jQuery-has-placeholder', true) } }); }