You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that the plugin for password fields assumes that the next element will be an <input> element that it generated; this is assumption is incorrect.
I know for password fields, this placeholder plugin simply clones a text field out of it, so it'll end up generating something like this:
<inputtype="password" placeholder="your placeholder text" style="display:none"><!-- visible when password is filled --><inputtype="text" value="your placeholder text"> <!-- visible when password is empty ->
In line 126 we see the use of next() to select the input field it has generated:
Here's where the problem arises
I'm using parsley.js for my client-side validation. Parsley programmatically adds <ul> right after the password field where it will show any errors if any exists. So it actually modifies the markup to be something like:
So as you can see above, assuming that next() is an input field is wrong and will result in problems. The solution would be to make the selection more specific than just a plain next(). Maybe like nextAll('input:first') or something better.
Some screenshots showing the issues
Initial state:
After clicking in the password input field it disappears:
The text was updated successfully, but these errors were encountered:
amerikan
changed the title
placeholder assumes next() element its input field
Password placeholder breaks when element is added between it and its clone text field
Dec 16, 2014
It seems that the plugin for password fields assumes that the next element will be an
<input>
element that it generated; this is assumption is incorrect.I know for password fields, this placeholder plugin simply clones a text field out of it, so it'll end up generating something like this:
In line 126 we see the use of
next()
to select the input field it has generated:Here's where the problem arises
I'm using parsley.js for my client-side validation. Parsley programmatically adds
<ul>
right after the password field where it will show any errors if any exists. So it actually modifies the markup to be something like:So as you can see above, assuming that
next()
is an input field is wrong and will result in problems. The solution would be to make the selection more specific than just a plainnext()
. Maybe likenextAll('input:first')
or something better.Some screenshots showing the issues
Initial state:
After clicking in the password input field it disappears:
The text was updated successfully, but these errors were encountered: