我想遍历线条元素。每个line元素都有item元素作为子元素。所以首先我遍历行,然后我想解决某个项目元素,例如第三个。这是我的代码:
$(".pricetable .righttable .line:not(.blank)").each(function(j) {
var currentLine = $(".pricetable .righttable .line:not(.blank)").eq(j);
currentLine.(".item").each(function(k) {
$(".pricetable .righttable .line .item").eq(i).addClass("active");
});
});
问题是我不知道如何使用item类来处理子元素。
currentLine.(".item").each(function(k)
这不起作用。
XML 过滤器应用于非 XML 值 ({0:#2=({}), length:1, prevObject:{length:3, prevObject:{0:#1=({}), context:#1# , 长度:1}, 上下文:#1#, 选择器:".pricetable .righttable .line:not(.blank)", 0:#2#, 1:({}), 2:({})},上下文:#1#,选择器:".pricetable .righttable .line:not(.blank).slice(0,1)"}) file:///C:/Users/xxx/lib/pricetable.js 第 112 行
编辑:
哇,我没想到我得到了如此好的和快速的响应!我想我会采用这个解决方案:
$(".pricetable .righttable .line:not(.blank)").each(function(j) {
$(this).children(".item").eq(i).addClass("active");
});