Auto Clear and Restore Form Element

Here’s another neat trick: making the search (or any field for that matter) have an auto clear and restore javascript element. This comes from Perishable Press.

<form action="http://domain.com/" method="post">
<p>
<input value="Click here and this will disappear.." onfocus="if(this.value == 'Click here and this will disappear..') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Click here and this will disappear..';}" type="text" size="77" />
</p>
</form>

Just change the value “Click here and this will disappear..” to anything you want wherever it appears in the code.

Related Posts with Thumbnails You can leave a response, or trackback from your own site.
No Comments Web

Add Your Comments

Required
Required
Tips

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <ol> <ul> <li> <q cite=""> <strike> <strong> <sub> <sup> <u>

Your email is never published nor shared.

Ready?