Created
November 21, 2011 21:05
-
-
Save overbalance/1383929 to your computer and use it in GitHub Desktop.
placeholder 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
if (!Modernizr.input.placeholder){ | |
$('input[placeholder],textarea[placeholder]').each(function(){ | |
var input = $(this); | |
if (!input.attr('placeholder')) return; | |
var ph = input.attr('placeholder'); | |
input.val(ph); | |
input.focus(function(){ | |
if (input.val() == ph) input.val(''); | |
}); | |
input.blur(function(){ | |
if (input.val() == '') input.val(ph); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment