6

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?

Tim Sullivan
  • 16,808
  • 11
  • 74
  • 120

3 Answers3

7

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

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
  • 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 Jan 12 '10 at 15:56
2

I have created a flexible plugin for this purpose. it gets to state: focused and filled and you can define your own css to manage the style such as visibility, color and ... check the samples and full doc for jQuery Placeholder here

user1553777
  • 241
  • 3
  • 7
0

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
  • 6,338
  • 25
  • 23