• Hello,

    I’m working on a search box in the navigation bar of my wordpress theme but can’t get it white when clicking and working at the same time. It would be great if someone could tell how to clear the field when clicking and when not entered getting back the ‘search…’.

    – I tried both of the code parts beneeth in the header.php

    This is the code that is working but not making it white when clicking…

    <div class="search-form">
    <?php $search_text = "Search"; ?>
    <form id="searchform" action="<?php bloginfo('home'); ?>/" method="get">
    <input id="s" onfocus="if (this.value == ' <?php echo $search_text; ?>') {this.value = '';}"
    onblur="if (this.value == '') {this.value = '<?php echo $search_text; ?>';}" type="text" name="s"
    value="<?php echo $search_text; ?>" />
    <input id="searchsubmit" type="hidden" /></form>
    </div>

    This is the code which is not working but making it white..

    <div class="search-form">
    <?php $search_text = "zoeken..."; ?>
    <form id="searchform" action="<?php bloginfo('home'); ?>/" method="get">
    <input type="text" value="zoeken..." onfocus="if(this.value=='zoeken...') this.value=''" onblur="if(this.value=='') this.value='zoeken...'">
    </div>

    Thanks a lot!

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Clear search with mouse click’ is closed to new replies.