2011-06-24 26 views
0

我有這樣的JS代碼:jQuery的表格TR:奇

$(".main-vervolg .right .bottom .panes table.grey tbody tr:odd").css("background-color", "#f8f8f8");

它工作正常,但是當我與級灰度,他在第二個表還計算2個獨立的表,但我想他會重新開始。

我該怎麼做?

+4

他== jQuery的所有表? :) – naveen

回答

5

嘗試以下操作:

$('.main-vervolg .right .bottom .panes table.grey').each(function() { 
    $('tbody tr:odd', this).css("background-color", "#f8f8f8"); 
}); 

它通過循環與選擇

+0

好:)這將工作! – Maanstraat