Javascript 类列表在IE9中不起作用
我得到了这个错误: 无法获取属性“2”的值:对象为null或未定义 IE9中的类列表。您可以使用以下选项:Javascript 类列表在IE9中不起作用,javascript,jquery,internet-explorer,Javascript,Jquery,Internet Explorer,我得到了这个错误: 无法获取属性“2”的值:对象为null或未定义 IE9中的类列表。您可以使用以下选项: $(e.target).siblings().classList[2] 你检查了类列表中的内容了吗?可能只有0/1,没有2,这是因为IE9()不支持classList;getting error child.attr不是函数,因为child.attr不是函数……在您使用的child代码中,是doElement而不是jQuery对象。这就是我使用$(this.attr)的原因。如果确实需要
$(e.target).siblings().classList[2]
你检查了
类列表中的内容了吗?可能只有0/1,没有2,这是因为IE9()不支持classList
;getting error child.attr不是函数,因为child.attr
不是函数……在您使用的child
代码中,是doElement
而不是jQuery
对象。这就是我使用$(this.attr
)的原因。如果确实需要child
,可以使用$(child.attr
)。
$(e.target).siblings().each(function()
{
var classes = $(this).attr("class").split(" ");
var myClass = classes[2];
});