Twifty
Twifty

Reputation: 3378

How do you set a search box to be initially empty?

Every time I open the home page to my site, the search box contains the contents from the previous search. Yet on almost every other web page these input fields are empty. I've looked into the source of a few websites and cannot find anything different to my own code. I don't beleive it's CSS related and I find it impossible to beleive that Javascript must be used. So how is it done? What am I missing?

<div id="search-bar">
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get autocomplete="off">
        <input type="text" name="s" value="" placeholder="<?php _e("Search...") ?>" />
        <input type="hidden" name="special" value="" />
        <input type="submit" />
    </form>
</div>

Upvotes: 1

Views: 365

Answers (1)

emerson.marini
emerson.marini

Reputation: 9348

Remove the placeholder bit:

placeholder="<?php _e("Search...") ?>"

Will be like this:

<input type="text" name="s" value="" />

Upvotes: 1

Related Questions