Ok, found a solution if anyone else is searching!
$('table.basic tr:nth-child(even)').addClass('even');
-Roman
On Mar 31, 2:45 pm, rsmolkin <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've ran into a little problem. I'm using the code below to do
> alternate row striping on a table.
>
> $('table.basic tr:even').addClass('even');
>
> The problem is, one of the cells of this table contains another
> (nested) table. So the tr:even selector is getting messet up, and is
> applying the row color to the nested table and then skips the actual
> next row in the table.
>
> Is there any way to do :even only on first level tr elements? I tried
> doing
> $('table.basic tr:first-child tr:even').addClass('even');
> But that doesn't work. Does anyone know how to do this right?
>
> Thanks,
> -Roman