In this article we will provide theme snippet for tweaking the search bar form via theme layer using form_alter in Drupal 7, That's right "form_alter" via theme layer instead of custom module :).

The purpose of this snippet is to add inline js that will show "search" text and when user click on the search bar, the "search" text will automatically removed using jQuery.

Here is the snippet :

  * Implementation of hook form alter

function yourthemename_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_block_form') {
    $form['search_block_form']['#title'] = '';
    $form['search_block_form']['#size'] = 25;
    $form['search_block_form']['#value'] = 'Search';
    $form['search_block_form']['#attributes']['onblur'] = "if (this.value == '') {this.value = 'Search';}";
    $form['search_block_form']['#attributes']['onfocus'] = "if (this.value == 'Search') {this.value = '';}";

Found a better way to do this? Post them in your comment.