jquery, find next element by class
Solution 1:
In this case you need to go up to the <tr>
then use .next()
, like this:
$(obj).closest('tr').next().find('.class');
Or if there may be rows in-between without the .class
inside, you can use .nextAll()
, like this:
$(obj).closest('tr').nextAll(':has(.class):first').find('.class');
Solution 2:
To find the next element with the same class:
$(".class").eq( $(".class").index( $(element) ) + 1 )