Skip to content

Instantly share code, notes, and snippets.

@fixlr
Created May 25, 2010 18:23
Show Gist options
  • Save fixlr/413484 to your computer and use it in GitHub Desktop.
Save fixlr/413484 to your computer and use it in GitHub Desktop.
$(".with_default").each(function() {
i = $(this);
i.val(i.attr("default"));
i.focus(function() {
if (i.val() == i.attr("default")) {
i.val('');
i.removeClass("with_default");
}
});
i.blur(function() {
if (!i.val()) {
i.val(i.attr("default"));
i.addClass("with_default");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment