jquery get the index of a row?

Posted by KnockKnockWhosThere on Stack Overflow See other posts from Stack Overflow or by KnockKnockWhosThere
Published on 2010-04-25T15:26:14Z Indexed on 2010/04/25 15:33 UTC
Read the original article Hit count: 273

Filed under:
|
|

I'm trying to write a function that will do something if the the row index is 0, and then something else if the row index is greater than 0. The zero part is working, but I can't figure out the syntax for rows that have an index greater than 0.

For the tr[0] row, I'm doing this:

if($("#mytable > tbody > tr ").index(0)) {

...

I tried:

if($("#mytable > tbody > tr ").index() > 0 ) {

But, that didn't work?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about row