Use the child combinator to select just the children of a certain
element. In your case, assuming you have an tbody element:

 $('table.basic > tbody > tr:even').addClass('even');


--Klaus


On Mar 31, 8: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

Reply via email to