Skip to content

Instantly share code, notes, and snippets.

@christopherhein
Created May 5, 2011 00:17
Show Gist options
  • Save christopherhein/956296 to your computer and use it in GitHub Desktop.
Save christopherhein/956296 to your computer and use it in GitHub Desktop.
Getting placeholders anywhere
$("input[type=text]").each(function(){
var curr_value = $(this).val();
$(this).focus(function(){
if($(this).val() == curr_value) {
$(this).val('').removeClass("placeholders");
}
});
$(this).blur(function(){
if($(this).val() == '') {
$(this).val(curr_value).addClass("placeholders");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment