I use this snippet:
<form id="searchform" method="get" action="search.php">
<input value="Search" name="s" id="s" onfocus="if (this.value == 'Search') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search';}" type="text">
</form>
If you want to change the text, make sure you edit it in all 3 places
this is what i have now
$form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
<div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label>
<input type="text" value="' . get_search_query() . ' " name="s" id="s" class="textbox" />
<input type="submit" id="searchsubmit" value="'. esc_attr__('') .'" class="searchsubmit" />
</div>
</form>';
I’m getting an error http://d.pr/a4nX
actually, this is what i have
<form id="searchform" method="get" action="search.php">
<input class="textbox" value="Search" name="s" id="s" onfocus="if (this.value == 'Search') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search';}" type="text">
<input type="submit" id="searchsubmit" value="" class="searchsubmit" />
</form>
but it doesn’t seem to work
http://pastebin.com/jDDXbg2U doesnt work, and the sidebar doesnt load
<form id="searchform" method="get" action="search.php">
<input class="textbox" value="Search" name="s" id="s" onfocus="if (this.value == 'Search') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search';}" type="text">
<input type="submit" id="searchsubmit" value="" class="searchsubmit" />
</form>
On its own that should work (though the ‘Go’ button will have no text).
If you’re still using the whole $form = … thing, then you’ll need to escape out all the apostrophes between $form = ' and the closing '; by putting a \ immediately before each one.
Nice one gwynf, this is working a treat.