Return to Snippet

Revision: 19763
at October 30, 2009 06:14 by joe-bbb


Updated Code
function setSearchKeywordField(selector, string){
	var selector = $(selector);
	selector.attr({ value: string }).focus(function(){
		if ($(this).val() == string) {
				$(this).val("");
			}
		}).blur(function(){
			if ($(this).val()=="") {
				$(this).val(string);
			}
		});
}

setSearchKeywordField("#header .right form input.textfield", "Search");

Revision: 19762
at October 30, 2009 06:09 by joe-bbb


Initial Code
function setSearchKeywordField(){
	$('#search input#search-box').attr({ value: 'Search the site...' }).focus(function(){
		if ($(this).val()=='Search the site...') {
				$(this).val("");
			}
		}).blur(function(){
			if ($(this).val()=="") {
				$(this).val('Search the site...');
			}
		});
}

Initial URL

                                

Initial Description

                                

Initial Title
set Search Keyword Field

Initial Tags
search

Initial Language
jQuery