javascript - JQuery IE问题

标签 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>

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

最佳答案

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

好处是我以“patchwelcome”的身份关闭了该票证,因此如果您认为您可以解决该问题的合理解决方案,那么我们很乐意审查和测试。

关于javascript - JQuery IE问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7297347/

相关文章:

javascript - Iframe 元素通过 Id 访问,给出 null

javascript - Contenteditable div 文本被添加到 span 元素中而不是外部

javascript - 单击 javascript 按钮时添加媒体

php - 联系表格 7 设置字段值与获取请求

javascript - 部署 AngularJS 1.x - Webpack 应用程序到 Tomcat

php - Facebook 连接对话框弹出窗口

c# - 将 Controller 的结果显示到 asp.net mvc c# 中的 View

html - 样式化 CSS 字体以在 html 页面上具有两种自定义字体

javascript - 无法在 d3.js 中的同一页面上生成两个饼图

javascript - Ajax 调用认为数据包含 [ ],而数据应该为空