JQuery IE问题

时间:2011-09-04 04:04:24

标签: javascript jquery html internet-explorer

我正在使用jQuery在焦点上进行从文本到密码类型的输入字段切换。此代码在Chrome中运行良好,但是当我尝试在IE 8中使用它时,它只是完全删除了该字段。 IE 8返回此错误:

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>

任何人都可以向我解释如何修复此错误吗?谢谢!

2 个答案:

答案 0 :(得分:3)

这是一个历史问题,您可以在此深入阅读:http://bugs.jquery.com/ticket/8232。简短的版本是在旧的IE中这根本不可行。

好处是我把这张票关闭为“patchwelcome”,所以如果你认为你可以解决这个问题的合理解决方案,那么我们更乐意进行审查和测试。

答案 1 :(得分:0)

在大多数情况下,这是与XML相关的问题。不是DOCTYPE,MIME类型是有问题的。 更多here

相关问题