diff --git a/README.md b/README.md index 4747836..a1bf501 100644 --- a/README.md +++ b/README.md @@ -25,12 +25,12 @@ This plugin was based on a code snippet by [Paul Irish](http://paulirish.com/), 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; } - .placeholder { color: #666; } + .placeholder { color: #aaa; } ## Notes -The plugin automatically checks if the browser supports the HTML5 placeholder attribute for inputs natively. If this is the case, the plugin won’t do anything. -The plugin will ignore password inputs. +* The plugin automatically checks if the browser supports the HTML5 placeholder attribute for inputs natively. If this is the case, the plugin won’t do anything. +* The plugin will ignore password inputs. ## Credits diff --git a/jquery.placeholder.js b/jquery.placeholder.js index a2c2602..c5fd724 100644 --- a/jquery.placeholder.js +++ b/jquery.placeholder.js @@ -1,5 +1,5 @@ /*! - * HTML5 Placeholder jQuery Plugin v1.0 + * HTML5 Placeholder jQuery Plugin v1.1 * @link http://github.com/mathiasbynens/Placeholder-jQuery-Plugin * @author Mathias Bynens */ @@ -37,11 +37,11 @@ return; }; setPlaceholder($input); - $input.focusin(function() { + $input.focus(function() { if ($input.val() === $input.attr('placeholder')) { $input.val('').removeClass('placeholder'); }; - }).focusout(function() { + }).blur(function() { setPlaceholder($input); }); }); diff --git a/jquery.placeholder.min.js b/jquery.placeholder.min.js index a0de164..1a019df 100644 --- a/jquery.placeholder.min.js +++ b/jquery.placeholder.min.js @@ -1,6 +1,6 @@ /*! - * HTML5 Placeholder jQuery Plugin v1.0 + * HTML5 Placeholder jQuery Plugin v1.1 * @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.focusin(function(){if(c.val()===c.attr('placeholder')){c.val('').removeClass('placeholder')}}).focusout(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(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