Created
January 25, 2011 16:17
-
-
Save ambienttraffic/795133 to your computer and use it in GitHub Desktop.
jquery function to clear the default value from a text field, and replace it with the default field if it's still empty.
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
$(document).ready(function(){ | |
$('#emailfield').click(function() { | |
if ($(this).val() == 'Your Email') { | |
$(this).data('original', $(this).val()).val(''); | |
} | |
}); | |
$('#emailfield').blur(function() { | |
if ($(this).val() == '') { | |
$(this).val($(this).data('original')); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment