diff --git a/jquery.placeholder.js b/jquery.placeholder.js
index fd8793c..813e3dc 100644
--- a/jquery.placeholder.js
+++ b/jquery.placeholder.js
@@ -1,5 +1,5 @@
/*!
- * HTML5 Placeholder jQuery Plugin v1.3
+ * HTML5 Placeholder jQuery Plugin v1.4
* @link http://github.com/mathiasbynens/Placeholder-jQuery-Plugin
* @author Mathias Bynens
*/
@@ -65,8 +65,8 @@
// Yes, .each() — in case .placeholder() is called on several elements, which is very likely, e.g. $('input').placeholder();
return this.each(function() {
var $input = $(this);
- // Quit if the current element is not an input/textarea at all
- if (!$input.is(':input')) {
+ // Quit if the current element doesn’t have a placeholder attribute, or is not an input/textarea at all
+ if (!$input.attr('placeholder') || !$input.is(':input')) {
return;
}
setPlaceholder($input);
diff --git a/jquery.placeholder.min.js b/jquery.placeholder.min.js
index a77d3c0..0f31631 100644
--- a/jquery.placeholder.min.js
+++ b/jquery.placeholder.min.js
@@ -1,6 +1,6 @@
/*!
- * HTML5 Placeholder jQuery Plugin v1.3
+ * HTML5 Placeholder jQuery Plugin v1.4
* @link http://github.com/mathiasbynens/Placeholder-jQuery-Plugin
* @author Mathias Bynens
*/
-(function(a){a.fn.placeholder=function(){if(this[0]&&'placeholder' in document.createElement('input')){return this}function b(f){var h=a('
').append(f.clone()).html().replace(/<(\w+)\s+(.*)>/,'$2'),e,g={};while((e=h.match(/\s*([\w-]+)=("[^"]*"|'[^']*'|\w+)/))){g[e[1]]=e[2].replace(/^(["'])(.*?)\1$/,'$2');h=h.replace(e[0],'')}return g}function c(){var e=a(this);if(e.val()===e.attr('placeholder')&&e.hasClass('placeholder')){if(e.data('placeholder-password')){e.next().show().focus().end().remove()}else{e.val('').removeClass('placeholder')}}}function d(f){var h;if(f.val()===''||f.val()===f.attr('placeholder')){if(f.is(':password')){try{h=f.clone().attr({type:'text'})}catch(g){h=a('',a.extend(b(f),{type:'text'}))}h.data('placeholder-password',true).focus(c);f.hide().before(h);f=h}f.addClass('placeholder').val(f.attr('placeholder'))}else{f.removeClass('placeholder')}}a('form:has([placeholder])').submit(function(){a('.placeholder',this).val('')});a(window).unload(function(){a('.placeholder').val('')});return this.each(function(){var e=a(this);if(!e.is(':input')){return}d(e);e.focus(c).blur(function(){d(e)})})}})(jQuery);
\ No newline at end of file
+(function(a){a.fn.placeholder=function(){if(this[0]&&'placeholder' in document.createElement('input')){return this}function b(f){var h=a('
').append(f.clone()).html().replace(/<(\w+)\s+(.*)>/,'$2'),e,g={};while((e=h.match(/\s*([\w-]+)=("[^"]*"|'[^']*'|\w+)/))){g[e[1]]=e[2].replace(/^(["'])(.*?)\1$/,'$2');h=h.replace(e[0],'')}return g}function c(){var e=a(this);if(e.val()===e.attr('placeholder')&&e.hasClass('placeholder')){if(e.data('placeholder-password')){e.next().show().focus().end().remove()}else{e.val('').removeClass('placeholder')}}}function d(f){var h;if(f.val()===''||f.val()===f.attr('placeholder')){if(f.is(':password')){try{h=f.clone().attr({type:'text'})}catch(g){h=a('',a.extend(b(f),{type:'text'}))}h.data('placeholder-password',true).focus(c);f.hide().before(h);f=h}f.addClass('placeholder').val(f.attr('placeholder'))}else{f.removeClass('placeholder')}}a('form:has([placeholder])').submit(function(){a('.placeholder',this).val('')});a(window).unload(function(){a('.placeholder').val('')});return this.each(function(){var e=a(this);if(!e.attr('placeholder')||!e.is(':input')){return}d(e);e.focus(c).blur(function(){d(e)})})}})(jQuery);
\ No newline at end of file