Closed janosh-xx closed 9 years ago
Link to an online demo that shows the issue. You’re probably using IE8 in IE7 mode or something.
This is a bug that I've reproduced consistently on real IE8, and IE10 running in IE8/9 mode.
Here is a live demo: http://bl.ocks.org/peterwalsham/9228025 And the code behind it: https://gist.github.com/peterwalsham/9228025
If you have an empty password field displaying the placeholder and you call .val() to get the value, the input will become type="text" for ever more
On any password field, empty or not, if you call .val('') to clear the value the input will become type="text" for ever more
Setting non-empty string on a password field with .val('Frog') always seems to be fine
As people have pointed out in other issues this is due to $('my_password_id') retrieving the cloned input with type="text" rather than the original with type="password"
Issue #107 is related
Actually I called the .val('') just to reset the password field after verification of the credentials (all this piece of code is not in the sample I have provided of course because it is not relevant to show the issue). Anyway, if it is recognized to be a bug, I'll wait for the fix before including this plugin in my website. Regards
I resolved this issue at my end by adding following line of code -
$(function () {
$('input[placeholder]').focusin(function () {
$('input[placeholder]').val('');
});
$('input[placeholder]').focusout(function () {
$('input[placeholder]').placeholder();
});
$('input[placeholder]').placeholder();
});
@janosh can you change the following line:
<form name="f_login" id="f_login" action="javascript:do_submit();">
to use onsubmit rather than action:
<form name="f_login" id="f_login" onsubmit="do_submit();">
OR you can just use an event listener:
<form name="f_login" id="f_login">
<script type="text/javascript" charset="utf-8">
$("#inputName").placeholder();
$("#inputPassword").placeholder();
$('#f_login').submit(do_submit); //when submitted ti will call the do_submit() method
function do_submit()
{
alert('login called');
$('#inputPassword').val('');
}
</script>
Should be fixed in latest version.
Hi Mathias look at this simple form:
open the HTML page in IE8. simply press the "login" button, without inserting nothing in the two fields. the do_submit function is called, the alert is shown. Close the alert box. Now go in the password field and enter something: it is in clear text... Am I using placeholder in the wrong way? Thanks