-
-
Save karamansky/8e477cba4d8d9a8fc5fd66bc7425ccf9 to your computer and use it in GitHub Desktop.
jQuery: Скрывать и показывать placeholder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// скрытие placeholder | |
$('input, textarea').on('focus', function () { | |
var $this = $(this); | |
var placehold = $this.attr('placeholder'); | |
$this.attr('data-placeholder', placehold); | |
$this.attr('placeholder', ''); | |
// $this.data($this, 'placeholder', placehold); | |
}); | |
$('input, textarea').on('blur', function () { | |
var $this = $(this); | |
$this.attr('placeholder', $this.data('placeholder')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment