jquery - IE 10 的 jQuery 问题

标签 jquery internet-explorer-10

我在 IE10 中使用 jQuery 时遇到一些问题。 有些脚本在该版本的 IE 中不起作用。 在其他浏览器(也在最旧的 IE 中)一切正常。 下面是其中一个的代码。

jQuery.fn.firma_wpis = function(form,wymag){
  var dur = 350;
  var wymag='1';
  if(this.attr('checked')==true){
    $("#wpis_firma").show(dur);
  }

我还添加了示例代码来查看它是否有效,但不幸的是没有

$(document).ready(function() {
  alert("Works fine");
}); 

这是用户单击复选框时简单的隐藏显示事件。 在IE10开发者工具中我发现这个错误: SCRIPT438:对象不支持属性或方法

最佳答案

尝试这个条件:

this.is(':checked')

即:

jQuery.fn.firma_wpis = function(form,wymag){
  var dur = 350;
  var wymag='1';
  if(this.is(':checked')){
    $("#wpis_firma").show(dur);
  }

关于jquery - IE 10 的 jQuery 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16288368/

相关文章:

JavaScript 无法在 Internet Explorer 10 上运行

internet-explorer - Internet Explorer 10 - 如何应用灰度过滤器?

html - IE10 图标问题

javascript - 根据值隐藏某些选项

javascript - 如何根据其值获取数字的名称?

javascript - jquery :nth-child() class is not working

jquery - 在 jquery 选项卡中定位表格

asp.net - FormsAuthentication.SetAuthCookie 在 IE10 和 IIS 6.0 中不起作用

css - 在 IE10 中输入样式输入字段时出现奇怪的 "jump"

javascript - 为什么我不能在 jquery 的一个选择器中获得所有第一个 td?