Skip to content

Commit

Permalink
Use focus() and blur() instead of focusin() and focusout() to ensure …
Browse files Browse the repository at this point in the history
…compatibility with previous jQuery versions. In this case, there’s no reason to choose focusin() over focus() anyway. Fixes issue mathiasbynens#3
  • Loading branch information
Mathias Bynens authored and Mathias Bynens committed Jul 2, 2010
1 parent 0a1f1ca commit dd7c626
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions 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 <http://mathiasbynens.be/>
*/
Expand Down Expand Up @@ -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);
});
});
Expand Down
4 changes: 2 additions & 2 deletions jquery.placeholder.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dd7c626

Please sign in to comment.