Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow calling `.placeholder()` more than once on the same element

Fixes #43.
  • Loading branch information...
commit c857b7cfa4e3645399df5c851948cf397bb40421 1 parent af988b1
@mathiasbynens authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 jquery.placeholder.js
View
6 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();
Please sign in to comment.
Something went wrong with that request. Please try again.