manhcodedao / jquery-watermark

Automatically exported from code.google.com/p/jquery-watermark
0 stars 0 forks source link

In IE8 calling .watermark('') then .val('') puts old watermark as field text #119

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Reproduced in IE8

What steps will reproduce the problem?
1. Define a password field and apply a watermark to it using .watermark("foo")

2. Upon some event, attempt to clear the password field of watermark and any 
value by calling .watermark("") then .val("")

What is the expected output? What do you see instead?
The expected output is a completely blank field.  Instead "foo" is the new 
value of the password field.

What version of the product are you using? On what operating system?
-jquery-watermark v3.1.4
-windows 7 IE8.0.7

Please provide any additional information below.
- A work around is to call .val("") twice.  Doing so will completely clear the 
field.

Original issue reported on code.google.com by jdp...@gmail.com on 21 Oct 2013 at 1:42

GoogleCodeExporter commented 8 years ago
This is not a problem with the plugin, and is well-documented here.  Because of 
the gyrations required in order to make watermarks work on old IE browsers, you 
have to be extremely careful with trying to programmatically change watermark 
text or element value text in a password element.  In fact, I recommend that 
you don't do it at all.

Maybe you could try turning off the watermark (not just changing its value to 
""), then changing the text, then turning the watermark back on.  You're going 
to have to experiment.  You'll need to read and understand the underlying code 
if you still can't make it work.

Original comment by t...@speednet.biz on 21 Oct 2013 at 2:28