/ Published in: jQuery
See also the plain JavaScript version.
Expand |
Embed | Plain Text
var elem = $(':text'); // delete default value on focus elem.focus(function() { if ( this.value == this.defaultValue ) { this.value = ''; } }); // regain default value on blur elem.blur(function() { if ( this.value == '' ) { this.value = this.defaultValue; } });
Comments
Subscribe to comments
You need to login to post a comment.

Thank you! Found good use of this, as I am a total beginner (if even I can be called that) in jQuery!