我使用jQuery来使从文本到焦点密码类型的输入字段开关。这段代码在Chrome中运行正常,但是当我尝试在IE 8中使用它时,它只是完全删除了该字段。 IE 8返回此错误:JQuery的IE问题
This command is not supported.
jquery.min.js
Line: 16
Char: 26827
这里是我使用的HTML代码:
<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>
任何人都可以向我解释,我怎么能修复这个bug?谢谢!
你试过取出分离()?似乎没有必要为你只是改变了属性 – Bodman
你不得不使用它,因为你不能改变装配的输入的类型。 – Matt
@Matt,是啊在IE安全问题。 – Bodman