Karl,

Thank you! This is what I was looking for!

Karl Swedberg schreef:
> One way to solve your dilemma is to use tr:nth-child(even). That will
> select all table rows that are an "even" child of their parent
> element. This should work:
>
> $("table tr:nth-child(even)").css("background", "#cccccc");
>
>
> --Karl
> _________________
> Karl Swedberg
> www.englishrules.com
> www.learningjquery.com
>
>
>
> On Feb 4, 2008, at 5:38 PM, Snef wrote:
>
> >
> > Hi,
> >
> > I know how to do some 'zebra-striping' on tables with jQ, but i have a
> > little problem.
> >
> > I have some (unknown amount) tables om a page and I want to 'stripe'
> > the tables seperately, so that all striping is the same in each table.
> >
> > With a simple:
> >
> > $("table tr:even").css("background", "#cccccc") the rows are counted
> > over all the tables and I want to start counting (for even and odd
> > rows) for every table, so i tought:
> >
> > $("table").each(function() {
> > // how to get the rows here???
> > })
> >
> > How do I do this? (I do not know on forehand how many or which tables
> > are on the page....)

Reply via email to