Палсеич— (lusever) wrote in changelog,
Палсеич—
lusever
changelog

[livejournal] r18047: LJSUP-7528: Recommended entries for ljti...

Committer: pkornilov
LJSUP-7528: Recommended entries for ljtimes.
U   trunk/htdocs/js/jquery_fn.js
Modified: trunk/htdocs/js/jquery_fn.js
===================================================================
--- trunk/htdocs/js/jquery_fn.js	2011-01-18 10:55:01 UTC (rev 18046)
+++ trunk/htdocs/js/jquery_fn.js	2011-01-18 11:01:21 UTC (rev 18047)
@@ -82,18 +82,20 @@
 			return this;
 		} else {
 			return this.each(function() {
-				var $this = jQuery(this);
+				if (this.getAttribute("placeholder")) {
+					var $this = jQuery(this);
 
-				$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.value === this.getAttribute("placeholder") || !this.value
+						? $this.val(this.getAttribute("placeholder")).addClass("placeholder")
+						: $this.removeClass("placeholder");
+				}
 			});
 		}
 	}

Tags: js, livejournal, lusever
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments