loisoft / jquery-watermark

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

CSS style class missing in input type password #63

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
To reproduce:

1. Add a simple watermark to a password input type.
2. Write something in the input in order to clean the watermark.
3. Use jQuery to add a CSS style class in the input.
4. Clean all text in the input, the watermark is displayed again. But the CSS 
style class is not there. Why? Because when the watermark is displayed the 
input password is changed to type="text" and that is a different input that the 
password, so this "text" input doesn't have the CSS style added in the password 
input.

I think that when the watermark is displayed again after clean the text in the 
input, the input "text" should have the style class that was added to the 
password input before clean the text.

Let me know if something is not clear or if you cannot reproduce the problem.

Thanks,
Victor

Original issue reported on code.google.com by victorbe...@gmail.com on 21 Jul 2011 at 7:37

GoogleCodeExporter commented 8 years ago
Victor, thanks, I understand what you are doing.

There is a simple solution to this.  Just add the class name to the watermark 
className option.

So let's say the class name you're applying to the password input is "myClass", 
and you're using a standard class name for the watermark of "watermark".  
Change the className option to "watermark myClass".  That will apply both class 
names to the text input element when it replaces the password type element.

That will get you going with the current version of the watermark plugin.  
However, I'll keep this issue open and investigate the possibility of adding 
the class names automatically.

Original comment by t...@speednet.biz on 21 Jul 2011 at 10:41

GoogleCodeExporter commented 8 years ago
I also ran into this problem when using the jQuery.validate.unobtrusive.js 
plugin.  I think this is an edge case though.

I have a wizard type of form, where each "page" of the wizard I validate the 
input fields individually.  I first remove the watermarks with hideAll() so the 
required validate will function.  Then validate, and finally show the 
watermarks with showAll().

If the field is in error, a class of 'input-validation-error' is added.  So, 
the problem I am having is that the 'input-validation-error' class is erased 
when the watermark is added.

I fixed the library in the _show function by copying the 
'input-validation-error' class, if it exists on $input, to $pwd.

Thanks, Blair.

Original comment by BLe...@gmail.com on 15 May 2012 at 5:16