Update Panel .NET

Exploring Microsoft ASP.NET AJAX and jQuery

jQuery Watermark Plugin (Version 1.0.1)

with 3 comments

I have just uploaded version 1.0.1 of my watermark plugin.

This release fixes positioning problems users have encountered when:

  • Browser windows is resized.
  • Elements are added or removed.
  • Visibility of input element is toggled.

In this updated version, instead of absolutely positioning the watermark <label> element based on the (initial) position of the <input> element, I inject an extra <span> before the <input> element, and use the <span> as the positioning container for the watermark <label>.

As the <span> is “statically” positioned, it “follows” the <input> element, and consequently, the watermark <label> also “follows” the <input> element.

Enjoy!

Written by tzkuei

July 1, 2009 at 11:08 pm

Posted in CSS, jQuery

Tagged with

3 Responses

Subscribe to comments with RSS.

  1. One of my users pointed to a drawback of using the watermark plugin on linux:
    The usual way to paste on linux is to use the middle mouse button. However, that no longer works for fields that have a watermark, because the latter receives the event, and firefox then wants to load the pasted text as a URL instead of writing it in the field.

    I did not find a solution to this problem yet, except for left-clicking first to hide the watermark.

    Emmanuel

    July 9, 2009 at 4:43 pm

  2. If my WP (http://aaa.com) and pic (http://bbb.com) are in the different host, would the plugin does work? If the answer is no, how to modify the code to make it work?

    Eric

    August 16, 2009 at 4:41 am

  3. Eric, yes you can host the plugin and images on separate domains.

    tzkuei

    August 17, 2009 at 12:29 pm


Leave a Reply