views:

336

answers:

4

Does a jQuery only solution exist for selecting a range of rows from a table?

I know 'eq', 'lt', 'gt' exist, but I'm looking for a combination of those selectors.

A: 

You can use the nthChild selector with an equation argument.

chaos
A: 

You can chain your 'eq', 'lt', 'gt' and this will progressively filter each successive returned array.

dalbaeb
A: 

You could use the jQuery filter; one form of this takes a callback function as an argument — you can write any complex code in it for the selection.

Siddhartha Reddy
+8  A: 

You can apply more than one filter at a time, although the 2nd filter applies to the results of the first, so the following would highlight starting from the 4th row (skips 0..2), and highlight for 3 rows (includes 0..2):

$('#t tr:gt(2):lt(3)').css('background-color', '#f00');
great_llama