Add Label in Search Field

Hi All,

We have the search field activated on our site however is there a way to have the text already set in the search bar call ‘Search’?

Some people do not realize its a search feature and therefore we would like to have an indicator there to allow people to know. Then when they click in it the word will disappear.. or something to that degree.


1 answer

Profile photo of thangnn1510 0.00 $tone February 3, 2011

Dear Media991!

Please backup your catalogsearch.phtml in app\design\frontend\default\your_themetemplate\ca talogsearch and then change it to this code:

PHP Code:

<form id="search_mini_form" action="<?php echo $this->helper('catalogSearch')->getResultUrl() ?>" method="get">
        <legend><?php echo $this->__('Search Site'?></legend>
        <div class="mini-search">
            <input id="search" type="text" class="input-text" name="<?php echo $this->helper('catalogSearch')->getQueryParamName() ?>" value="<?php echo $this->helper('catalogSearch')->getEscapedQueryText() ?>" />
            <button type="submit" class="form-button"><span><?php echo $this->__('Search'?></span></button>
            <div id="search_autocomplete" class="search-autocomplete"></div>
            <script type="text/javascript">
                var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('Search entire store here...'?>');
                searchForm.initAutocomplete('<?php echo $this->helper('catalogSearch')->getSuggestUrl() ?>', 'search_autocomplete');



Please login or Register to Submit Answer

Written By