Hi, How do I format a search box to automatically clear the pre-set text in the search box when someone clicks in the box? In other words how do I change the search box at couponclicks(dot)com... to work like the search box at retailmenot(dot)com I hope this is understandable. Thanks in advance for any help.
That would require a small piece of JavaScript.. Put the following code in your <head> tag: <script language="Javascript"> <!-- function doClear(theText) { if (theText.value == theText.defaultValue) { theText.value = "" } } //--> </script> Code (markup): In your <input> tag, make the following changes: That should work for you
Use this script so that it could auto clear words in the search box when you click in it, and auto resume when lost focus. Replace the red part with your own text. <input type="text" name="s" id="s" value="default words" onfocus="if (this.value == 'default words') {this.value = '';}" onblur="if (this.value == '') {this.value = 'default words';}" />