Clear Text Box When Clicking on It
If you have a text box on your webpage (eg – a search form) with text in it (eg – “Search…”), it adds an extra level of convenience for your user if the text box clears when the user clicks inside the box. This is achieved with some simple javascript:
The crucial part is onclick=”this.value=”;” – whenever the text box is clicked on, it sets the text box’s value to empty.
If you want, you could have the box automatically refilled with the same text or different text with this simple addition to the above code.
onblur="if (this.value == '') {this.value = 'PREFILLING_VALUE';
You may have already noticed the Search form and Email Subscription form are configured this way. Try it out.
