Skip to content

Instantly share code, notes, and snippets.

@jwlawrence
Created May 16, 2011 19:25
Show Gist options
  • Save jwlawrence/975134 to your computer and use it in GitHub Desktop.
Save jwlawrence/975134 to your computer and use it in GitHub Desktop.
Helpful jQuery functions
// Ghost Text
$(".populate input").each(function() {
if ($(this).val() == "") {
$(this).val($(this).attr("title"));
}
});
$(".populate input").focus(function() {
if ($(this).val() == $(this).attr("title")) {
$(this).val("");
}
});
$(".populate input").blur(function() {
if ($(this).val() == "") {
$(this).val($(this).attr("title"));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment