Selecting even rows through it class name <p>Problem selecting even rows through it class name:</p> <pre><code>$(".recDetails table tr").each(function() { if( !($(this).css("display") == "none")){ $(this).addClass("block"); }; }); $(".recDetails table").each(function(i) { $(this).find("tr.block:even").css("background-color", "#fff"); $(this).find("tr.block:odd").css("background-color", "#efefef"); }); </code></pre> <p>It is taking into the count all of the "<strong>tr</strong>" so:</p> <pre><code>(1) tr class="block" (2) tr (3) tr class="block" </code></pre>