WordPress.org

Support

Search box

  • How do you put the word “search” in the search box instead of a seperate button beside or below the search box?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Change the search input to:

    <input type="text" name="s" id="s" size="15" value="Search" />

    More interesting method:

    <input type="text" name="s" id="s" size="15" onfocus="this.value=''" value="<?php if (!$s) { $s = "Search"; } echo $s; ?>" />

    cool idea!

    Thank you, that worked!

    Kafkaesqui,

    I use Kubrick’s search form. It says:

    <form method="get" id="searchform" action="<?php echo $PHP_SELF; ?>">
    <input type="text" value="<?=htmlentities($s); ?>" name="s" id="s" />
    <input type="submit" id="searchsubmit" name="Submit" value="<?php _e('Go!'); ?>" />
    </form>

    So I know I can make the first suggestion you made and place it in the first line of code here, but I don’t know enough about forms yet to know how to remove the “go” button without screwing things up. I see the php_e(‘Go!), and I figure that’s where I need to make a change, but need a little more help if you please. 🙂

    Just remove:
    <input type="submit" id="searchsubmit" name="Submit" value="<?php _e("Go!"); ?>" />
    That’s the “go” button.

    Let me understand: you don’t want a submit button with your search form? If that’s the case, you can remove the whole <input type="submit" ... line, so that you’re left with:

    <form method="get" id="searchform" action="<?php echo $PHP_SELF; ?>">
    <input type="text" value="<?=htmlentities($s); ?>" name="s" id="s" />
    </form>

    It’s important to note that one would then need to hit the Enter key on their keyboard to submit a search, and not everyone is going to figure that out.

    Thanks pezastic and Kafkaesqui.

    …and not everyone is going to figure that out.

    I agree. On second thought, with the audience I’m targeting with my blog, they may think it’s an error. But now I know a little more about the form code. 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Search box’ is closed to new replies.
Skip to toolbar