Rather than type a long explanation of what exactly this is and what it does, it's best to just show you:
If you still don't understand what this does, here's a short explanation: Onfocus of form field, default value is automatically cleared and, if no value is entered, return the default value (onblur).Why use this? Personally, I feels it's a waste of space to label form fields (perfect example on the NY Times Login Page) ...it also looks pretty cluttered.Enough jibjab, here's how I do it (there are other ways, of course...but this one seems to work easiest and the best):
<input class="input" name="fieldname" value="Click in me then click away" onfocus="if(this.value == 'Click in me then click away') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Click in me then click away';}">
This entry was posted on Friday, March 7th, 2008 at 3:06 pm and is filed under Blog, Javascript, WebDev. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Get a Trackback link
1 Trackbacks/Pingbacks
Leave a comment