![]() |
Inserting an initial value in to the search box
I'm doing an artwork overhaul on a 4.1.6 site and I want to set a word as the initial value in the search box.
In straight HTML I would use value="blah blah", but the value is already set in the x-cart box as value="{$search_prefilled.substring|escape}" How can I go about getting the word 'Search' to appear as an initial value in the search box without disturbing what x-cart as in there already? |
Re: Inserting an initial value in to the search box
try ...
Code:
<input type="text" name="posted_data[substring]" {if $search_prefilled.substring|escape}value="{$search_prefilled.substring|escape}"{else}value="Enter search term" autocomplete="off" onKeyUp="ajax_showOptions(this,'getProduct',event)" onfocus="if(this.value=='Enter search term') this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;"{/if} /> |
Re: Inserting an initial value in to the search box
An underused html attribute that works in modern browsers is placeholder.
Use it like this <input type="text" placeholder="blah, blah">. I used to do it with javascript, but this works great. |
Re: Inserting an initial value in to the search box
Thanks Darren. The javascript worked a charm.
|
All times are GMT -8. The time now is 09:56 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.