I am using jQuery to make an input field switch from a text to password type on focus. This code works fine in Chrome, but when I try to use it in IE 8 it just completely removes the field. IE 8 returns this error:
This command is not supported.
jquery.min.js
Line: 16
Char: 26827
Here is the HTML code I am using:
<div id="reg_passdiv" style="margin-bottom: 5px;">
<input name="reg_pass" class="inputbar italic" type="text" value="Password..." onfocus="if ($(this).attr('class') == 'inputbar italic') { $(this).attr('class', 'inputbar reg'); $(this).detach().attr('type', 'password').appendTo('#reg_passdiv'); this.value = ''; $(this).focus(); }" onblur="if (this.value == '') { $(this).attr('class', 'inputbar italic'); $(this).detach().attr('type', 'text').appendTo('#reg_passdiv'); this.value = 'Password...'; }" spellcheck="false">
</div>
Can anyone explain to me how I can fix this bug? Thanks!
This is a historically problematic issue, which you can read about in depth here: http://bugs.jquery.com/ticket/8232 . The short version is that this is simply not feasible in older IEs.
The upside is that I closed that ticket as "patchwelcome", so if you think you can tackle a reasonable fix for the issue, then we're more then happy to review and test.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With