Return to Snippet

Revision: 29678
at August 3, 2010 03:29 by supermauerbros


Initial Code
$.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();

Initial URL
http://bassistance.de/2007/01/23/unobtrusive-clear-searchfield-on-focus/

Initial Description

                                

Initial Title
Auto Clear Search Box Value on focus

Initial Tags
plugin, search, jquery

Initial Language
jQuery