Stuart wrote:
I'm trying to figure out an efficient way to select a range of table
rows. What I'd like to do is select perhaps rows 11 through 19.

I want to have the selector put the desired rows into the jquery
object instead of grabbing all rows and looping through them to
operate only on the ones I want.

I keep thinking something like this where the .not() sets the range.
It seems almost right but I know its not.
var firstRow = 11, lastRow = 19;

$('#myTable tr').not(':lt(' + firstRow + '), :gt(' + lastRow + ')');

I know it's simple I just haven't hit on it yet.


Have you tried (pre jQuery 1.1.4.):

$('tr').lt(19).gt(10);

If you're using jQuery 1.1.4 you should use the new slice method:

$('tr').slice(10, 18);

(not sure about the correct numbers right now)



--Klaus

Reply via email to