views:

244

answers:

2

I have some <input>s on my form, and I would like to watermark them with field labels. There are already myriad watermarking plugins, but best as I can tell they all clear the watermark when the <input> is focused, even if there's nothing entered.

What I'd like, ideally, is something that would continue to display until the user typed something in, focused or not.

Does anyone know of a plugin that does this already, or know of a code sample that might help guide my way?

+5  A: 

This plugin will retain the watermark when the input is focused, although it will hide on any keypress (even Ctrl).

SLaks
I actaully ended up going with Paul Elliot's fork of that plugin, which requires a lot less CSS/HTML tomfoolery. http://github.com/paulelliott/In-Field-Labels-jQuery-Plugin. It's not perfect, but it's a great starting point.
Tim Sullivan
A: 

As another alternative, if you like one of the other plugins better for other reasons, it wouldn't be very difficult to alter the script so that watermark disappears on keyup rather than focus.

Nate B