jQuery: find next table-row

This should give you the enclosing tr of the element, even if it isn’t the element’s direct parent, then that row’s next row. if you use parent on an element that is inside a td, it will give you the column, not the row. Supplying a filter to the parent() method will simply filter out the parent unless it happens to match the filter, typically resulting in no matching elements. Closest is probably what you want, but parents(‘tr’) might be needed if you have nested tables and want the outer row instead of the inner row.

$(this).closest('tr').next('tr')

Leave a Comment