我可以使用什么代替:indeterminate jQuery选择器来避免IE 8中的异常? [英] What can I use instead of the :indeterminate jQuery selector to avoid an exception in IE 8?

查看:179
本文介绍了我可以使用什么代替:indeterminate jQuery选择器来避免IE 8中的异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的代码

if ($('#chkCheckAll').is(':indeterminate') == true) 
{
}

但它在8中抛出异常

在Jquery中可以用什么代替这个来处理ie8

what can do instead of this in Jquery to work with ie8

推荐答案

改为使用:

var $allChk = $('#chkCheckAll');
if ($allChk[0] && $allChk[0].indeterminate ) {
  ... 
}

问题是IE8 querySelectorAll 实现不支持':indeterminate'伪表达式。但在你的情况下,它实际上不需要使用它,因为你可以查询DOM元素本身的相应属性

The problem is that ':indeterminate' pseudo-expression is not supported by IE8 querySelectorAll implementation. But in your case, it's actually not required to use it, as you can query the corresponding property of DOM element itself

这篇关于我可以使用什么代替:indeterminate jQuery选择器来避免IE 8中的异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆