Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个js代码:
$(".main-vervolg .right .bottom .panes table.grey tbody tr:odd").css("background-color", "#f8f8f8");
它工作正常,但是当我有 2 个单独的表时,他会在第二个表中进一步计数,但我希望他能重新开始。
我怎样才能做到这一点?
尝试以下操作:
$('.main-vervolg .right .bottom .panes table.grey').each(function() { $('tbody tr:odd', this).css("background-color", "#f8f8f8"); });
它使用选择器遍历所有表