Skip to content

Commit

Permalink
Allow calling .placeholder() more than once on the same element
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens committed Dec 6, 2011
1 parent af988b1 commit c857b7c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jquery.placeholder.js
Original file line number Diff line number Diff line change
@@ -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'),
Expand All @@ -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();
Expand Down

0 comments on commit c857b7c

Please sign in to comment.