Onclick Delete Contents Onblur Put Back Value


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

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


Copy this code and paste it in your HTML
  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>

URL: http://www.imbenc.co.uk

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.