Created
September 5, 2012 10:46
-
-
Save Relequestual/3634893 to your computer and use it in GitHub Desktop.
Remove helper text when given focus and re-display helper text when loose focus and empty
This file contains hidden or 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, textarea").focus(function(){ | |
if ($(this).val() == $(this).attr("title")) { | |
$(this).val(""); | |
} | |
}).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
Why not use the placeholder attribute?