Skip to content

Instantly share code, notes, and snippets.

@gopperman
Forked from anonymous/gist:5967714
Created July 10, 2013 16:19
Show Gist options
  • Save gopperman/5967717 to your computer and use it in GitHub Desktop.
Save gopperman/5967717 to your computer and use it in GitHub Desktop.
jQuery(document).ready(function() {
jQuery.fn.cleardefault = function() {
return this.focus(function() {
if( this.value == this.defaultValue ) {
this.value = "";
}
}).blur(function() {
if( !this.value.length ) {
this.value = this.defaultValue;
}
});
};
jQuery("input, textarea").cleardefault();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment