/ Published in: jQuery
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
$.fn.search = function() {
return this.focus(function() {
if( this.value == this.defaultValue ) {
this.value = "";
}
}).blur(function() {
if( !this.value.length ) {
this.value = this.defaultValue;
}
});
};
$("#s").search();
URL: http://bassistance.de/2007/01/23/unobtrusive-clear-searchfield-on-focus/
Comments
 Subscribe to comments
                    Subscribe to comments
                
                