jQuery selector for every row except the first on every table except first

css-selectors, jquery

Solution

You were almost there.

$("table:gt(0)").find("tr:gt(0) td:last-child").css("text-align", "right");

otherwise, tr:gt(0) is always true because jquery is looking at each tr, not each tr in each table.

Problem

I want to apply right alignment on the last cell of every table row, skipping the first table on the page and skipping the first row of every table. I wrote the following: ``` $("table:gt(0) tr:gt(0) td:last-child").css("text-align", "right"); ``` - The tables after the first are selected. GOOD. - The last cell in each row is aligned right. GOOD. - The first row in the first table in the result set is skipped. GOOD. - Each first row in subsequent tables in the result set has the style applied. BAD. I've tried passing a function to the "each" method on the wrapped set, but that isn't working. Any ideas?

Original source