Change Search Bar Default Text via Form Alter

WE HAVE MOVED!

Please visit our new Drupal Website at https://www.xenyo.com我們的新網頁設計公司網頁.

<?php
function YOURthemeORmodule_form_search_block_form_alter(&$form, &$form_state, $form_id) {
 $form['search_block_form']['#default_value'] = t('your default text');     
 $form['search_block_form']['#attributes'] = array('class' => array('your_class'), 
                                                              'onfocus' => "if (this.value == '". t('your default text'). "') {this.value = '';}",
                                                              'onblur' => "if (this.value == '') {this.value = '". t('your default text'). "';}"); 
 
}
?>
Help Share this Article