Couldn't you just use $(this) and then do whatever selector?

$("table").each(function() {
        $(this).find('tr:even').css("background-color", "#bbbbff");
});

Maybe I don't understand the question.

Allex

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Snef
Sent: Monday, February 04, 2008 2:38 PM
To: jQuery (English)
Subject: [jQuery] Zebra striping in tables



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