Sep
27th

Put Tips in your Text Fields with JavaScript

Real estate is a premium on a web site, so I’m trying to be a little more efficient with mine. I found this nifty little script with the Cutline WordPress theme from Tubetorial.

You can build a couple events directly in your text field HTML that will show and hide data as the field is entered and exited. Try it out on my sidebar where you can register for an email subscription to the blog.

<input type="text" name="email" value="Enter your email address" onfocus="if (this.value == ‘Enter your email address’) {this.value = ”;}" onblur="if (this.value == ”) {this.value = ‘Enter your email address’;}" />

Nifty!

RSS feed | Trackback URI

Comments »

No comments yet.

Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

My Comment Policy: I moderate comments. Please be patient:

  • Spam will happily be destroyed.
  • Use your real name, not some keywords. Otherwise it will be destroyed.
  • Mean comments aren't necessary. If I don't post them I will reply personally to let you know why.
  • Lewd comments will be edited, I don't want my readers leaving because of offensive content.
Great debate, criticism and colorful commentary is always appreciated and approved!