Skip to content

Commit

Permalink
Also set the placeholder class in case the input’s value equals the p…
Browse files Browse the repository at this point in the history
…laceholder on page load (e.g. when reloading the page in browsers who remember form data)
  • Loading branch information
mathiasbynens committed Jan 20, 2010
1 parent 3ee0418 commit 2c5f6be
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jquery.placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// 1) Once when the DOM is loaded;
// 2) Once every time the focusout() is triggered.
function setPlaceholder($elem) {
if ($elem.val() === '') {
if ($elem.val() === '' || $elem.val() === $elem.attr('placeholder')) {
$elem.addClass('placeholder').val($elem.attr('placeholder'));
};
};
Expand Down
2 changes: 1 addition & 1 deletion 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 2c5f6be

Please sign in to comment.