Skip to content Skip to sidebar Skip to footer

Default Value In The Search Box Of The Google Custom Search

I am using the standard copy and paste code for the Google Custom Search (free with ads). I want to have some text in the search field when the page is loaded is that possible? If

Solution 1:

Use the "results only" code. By doing so, you can use your own search box.

If you want some text to show up in the search field, try this:

<form id="cse-search-box" action="http://www.yoursite.com/" method="get">

<input type="text" name="q" autocomplete="off" size="30" onfocus="if(this.value==this.defaultValue)value=''" onblur="if(this.value=='')value=this.defaultValue;" value="THE TEXT YOU WANT HERE" /> 

</form>

Post a Comment for "Default Value In The Search Box Of The Google Custom Search"