Created
September 7, 2012 00:14
-
-
Save Sergic/3661735 to your computer and use it in GitHub Desktop.
ie8 html5 placeholder (jquery)
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
$('input[placeholder]').each(function(){ | |
var input = $(this); | |
$(input).val(input.attr('placeholder')); | |
$(input).focus(function(){ | |
if (input.val() == input.attr('placeholder')) { | |
input.val(''); | |
} | |
}); | |
$(input).blur(function(){ | |
if (input.val() == '' || input.val() == input.attr('placeholder')) { | |
input.val(input.attr('placeholder')); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment