Support » Fixing WordPress » Initial Text in Search Box?

  • Resolved aptdesignonline



    I’m trying to insert a search box in my header. I’ve done that with get_search_box

    What I would like to now do is have there be initial text in that form that says “Search” that when clicked on goes away and you can type in your own search query.

    Is this possible to do with the WP get_search_box? Or, any other suggestions for how to do this?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Mark Ratledge


    Forum Moderator

    This is what I use:

    <form id="searchform" method="get" action="<?php bloginfo('url'); ?>/"><input type="text" value="Search this site" onblur="if(this.value == '') {this.value = 'Search this site';}" onfocus="if(this.value == 'Search this site') {this.value = '';}" name="s" id="s" size="25" />
    <input type="submit" id="searchsubmit" value="Search" class="submit" name="searchsubmit"/></form>

    Style the text if you want:

    #searchform, input#s
    font-size: 1em;
    font-style: italic;

    I have the following code on my search and wanted to achieve the same thing but somehow when I use the info above it does not working for me. I there something I miss?
    <form method=”get” id=”searchform” action=”” >
    <input type=”text” value=”” />
    <input type=”submit” id=”searchsubmit” value=”” />

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Initial Text in Search Box?’ is closed to new replies.