From c857b7cfa4e3645399df5c851948cf397bb40421 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Tue, 6 Dec 2011 16:23:44 +0000 Subject: [PATCH] Allow calling `.placeholder()` more than once on the same element Fixes #43. --- jquery.placeholder.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jquery.placeholder.js b/jquery.placeholder.js index 694e761..53774ee 100644 --- a/jquery.placeholder.js +++ b/jquery.placeholder.js @@ -1,4 +1,4 @@ -/*! http://mths.be/placeholder v1.8.5 by @mathias */ +/*! http://mths.be/placeholder v1.8.6 by @mathias */ ;(function(window, document, $) { var isInputSupported = 'placeholder' in document.createElement('input'), @@ -15,7 +15,9 @@ } else { $.fn.placeholder = function() { - return this.filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]') + return this + .filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]') + .not('.placeholder') .bind('focus.placeholder', clearPlaceholder) .bind('blur.placeholder', setPlaceholder) .trigger('blur.placeholder').end();