Revision: 40474
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 2, 2011 21:09 by riddla
Initial Code
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; } });
Initial URL
Initial Description
See also the [plain JavaScript version](http://snipplr.com/view/41717/default-value-for-input-fields/).
Initial Title
Default value for input fields (jQuery version)
Initial Tags
form, javascript, html, forms
Initial Language
jQuery