While developing OLEFA, adding and tweaking features, I wanted to do something with my input fields that is called watermark. Watermark is some sort of caption inside a form control, which disappears once you focus the control. As I searched around the Internet for ways to get this done I noticed that there is only one way to do that... using a background image that is.
Thinking about it, I decided it was not a good way to implement it. Not every web developer is an ace graphical designer or has a habit designing things (I, for instance, even have trouble creating icons from simple shapes) and, let's face it, most are too lazy to open up Photoshop or Gimp. And once you have it done, you better not change the design because you would have to change ALL the images to make it look consistent.
So, rather than opening GIMP and swearing a lot, I decided to implement it using a different approach with jQuery and wrote some Code. It uses the input value for the watermark text instead of the background image. The look of the watermark can be changed using a CSS class you define. I have written it as a plugin so it can be used like this:
jQuery(selector).watermark('here be text...','cssClass');
No fiddling around, it's all you need. If you are interested in the plugin, you can download it here.
I am also working on a documentation page with Examples so stay tuned ;)
Upgrade to Wordpress 2.8.1
Vor 3 Tagen

