diff --git a/README.md b/README.md
index 6a372cd..d3341ea 100644
--- a/README.md
+++ b/README.md
@@ -10,21 +10,22 @@ This plugin was based on a code snippet by [Paul Irish](http://paulirish.com/),
### HTML
-
-
-
-
-
+
+
+
+
+
+
### jQuery
- $('input').placeholder();
+ $('input, textarea').placeholder();
### CSS
The plugin automatically adds `class="placeholder"` to the elements who are currently showing their placeholder text. You can use this to style placeholder text differently:
- input { color: #000; }
+ input, textarea { color: #000; }
.placeholder { color: #aaa; }
## Notes
diff --git a/jquery.placeholder.js b/jquery.placeholder.js
index c5fd724..2e46d05 100644
--- a/jquery.placeholder.js
+++ b/jquery.placeholder.js
@@ -1,5 +1,5 @@
/*!
- * HTML5 Placeholder jQuery Plugin v1.1
+ * HTML5 Placeholder jQuery Plugin v1.2
* @link http://github.com/mathiasbynens/Placeholder-jQuery-Plugin
* @author Mathias Bynens
*/
@@ -20,8 +20,8 @@
$elem.removeClass('placeholder');
};
};
- // This selector could be shortened to form:has([placeholder]) but that would be less efficient
- $('form:has(input[placeholder])').submit(function() {
+ // Look for forms with inputs and/or textareas with a placeholder attribute in them
+ $('form:has([placeholder])').submit(function() {
// Clear the placeholder values so they don’t get submitted
$('.placeholder', this).val('');
});
@@ -32,7 +32,7 @@
// 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 a password input, or not an input at all
+ // Quit if the current element is a password input, or not an input/textarea at all
if ($input.is(':password') || !$input.is(':input')) {
return;
};
diff --git a/jquery.placeholder.min.js b/jquery.placeholder.min.js
index 1a019df..16b2e34 100644
--- a/jquery.placeholder.min.js
+++ b/jquery.placeholder.min.js
@@ -1,6 +1,6 @@
/*!
- * HTML5 Placeholder jQuery Plugin v1.1
+ * HTML5 Placeholder jQuery Plugin v1.2
* @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(c){if(c.val()===''||c.val()===c.attr('placeholder')){c.addClass('placeholder').val(c.attr('placeholder'))}else{c.removeClass('placeholder')}}a('form:has(input[placeholder])').submit(function(){a('.placeholder',this).val('')});a(window).unload(function(){a('.placeholder').val('')});return this.each(function(){var c=a(this);if(c.is(':password')||!c.is(':input')){return}b(c);c.focus(function(){if(c.val()===c.attr('placeholder')){c.val('').removeClass('placeholder')}}).blur(function(){b(c)})})}})(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(c){if(c.val()===''||c.val()===c.attr('placeholder')){c.addClass('placeholder').val(c.attr('placeholder'))}else{c.removeClass('placeholder')}}a('form:has([placeholder])').submit(function(){a('.placeholder',this).val('')});a(window).unload(function(){a('.placeholder').val('')});return this.each(function(){var c=a(this);if(c.is(':password')||!c.is(':input')){return}b(c);c.focus(function(){if(c.val()===c.attr('placeholder')){c.val('').removeClass('placeholder')}}).blur(function(){b(c)})})}})(jQuery);
\ No newline at end of file