Skip to content

Instantly share code, notes, and snippets.

@joshmvandercom
Created April 13, 2010 17:46
Show Gist options
  • Save joshmvandercom/364866 to your computer and use it in GitHub Desktop.
Save joshmvandercom/364866 to your computer and use it in GitHub Desktop.
jQuery.fn.clearThis = function() {
return this.each(function(){
var initVal = $(this).val();
$(this).click(function(){
if ($(this).val()==initVal) {
$(this).val('');
}
});
$(this).blur(function(){
if ($(this).val()=='') {
$(this).val(initVal);
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment