Posted By

Unreal on 02/28/09


delete Value back onclick contents Onblur Put

Versions (?)

Onclick Delete Contents Onblur Put Back Value

 / Published in: JavaScript


Nice little snippet. Should be used on all text fields in my opinion.

  1. <form action="search.php" method="get">
  2. <input type="text" name="q" size="40" class="q" id="q" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}" />
  3. <input type="submit" value="Search">
  4. </form>

Report this snippet  

You need to login to post a comment.