0

Possible Duplicate:
JQuery: How to select rows from a table

I am a beginner in jQuery. I have a table with multiple rows, how do I select next row or previous row after selecting a particular row?

Community
  • 1
  • 1

2 Answers2

1

For the next row (assuming myRow is your selected row element):

$(myRow).next();

I'd recommend using the very powerful selector syntax, instead of selecting previous and next elements based on currently selected element instances, however:

http://docs.jquery.com/Selectors

gn22
  • 2,076
  • 12
  • 15
0
$(this).next();

or

$(this).prev();
Jake Wilson
  • 88,616
  • 93
  • 252
  • 370
  • I am selecting a row using "onclick" event and changing its class name to "xyz". now I want the next row to the row with classname "xyz". I have used $(".xyz").next() & $(".xyz").prev(), but the result set is empty. –  Oct 14 '09 at 06:13