Search form with onblur and onfocus text


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
  2. <input type="text" onblur="if (this.value == '') {this.value = 'To search, type and hit enter';}" onfocus="if (this.value == 'To search, type and hit enter') {this.value = '';}" value="<?php if ($_REQUEST['s']) { the_search_query(); } else { echo 'To search, type and hit enter'; } ?>" name="s" id="s" />
  3. </form>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.