tags:

views:

59

answers:

1

Can Jquery zebra stripe a table where some rows are being set to 'display:none' and still have the visable rows alternate in color, without two rows having the same color next to each other?

+7  A: 

This is possible with the :visible and the :odd (or the :even) selectors:

$('table').find('tr:visible:odd').addClass('odd');

Then you can do:

table tr td {
    background-color: #fff;
}

table tr.odd td {
    background-color: #c1c1c1;
}
Paolo Bergantino
How about $('tr:visible:odd').addClass('odd')?
adardesign