views:

1136

answers:

3

I can get the current row using this code. The "this" is a link in a table cell in the row.

$currentTR = $(this).parents('tr');

These next two lines can do the same thing, get the tr after the current row.

$nextTR = $(this).parents('tr').next();  
$nextTR = $(this).parents('tr').next('tr');

If I output $nextTR.html() I see what I expect

I don't know how many rows I need to go to get to the correct row except by class name and doing it like this doesn't work for me.

$nextTR = $(this).parents('tr').next('.concept');  
$nextTR = $(this).parents('tr').next('tr .concept');

All I get is null

The example on docs.Jquery link text uses this

$("p").next(".selected").css("background", "yellow");

What am I missing here?

A: 

You want to get the next one that is of a certain class?

You could try doing .next() and then checking the class perhaps?

I'm slightly confused about your question, i'll admit, because you seem to have provided your own answer ...

Noon Silk
+4  A: 

Give nextAll a shot.

Andy Gaskell
Crap, I was going to come up with a fancy solution using the new `index` function, but `$(this).closest('tr').nextAll('tr.concept').eq(0) seems like a winner`. :)
hobbs
So this makes sense. Does nextAll go to the bottom of the page from current position and then start back at the top of the dom and come back to the start position, and that is how many elements get returned?
Breadtruck
@Breadtruck - no. In your example nextAll returns all rows after the "current" row.
Andy Gaskell
+1  A: 
bjelli
next only returns the next element. If the selector you send into your call to next doesn't match the next element your result set will be empty.
Andy Gaskell