Created
September 23, 2018 12:14
-
-
Save karamanskiy/0be5d79bd0633450efa3f719bf170fde to your computer and use it in GitHub Desktop.
Скрывать и показывать placeholder
This file contains 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