Reputation: 1606
I have a div with a class of active
. I need to find the 3rd div after this div with the class .slide-item
.
I have tried:
$('.active').next('.slide-item').next('.slide-item').next('.slide-item img').data('src');
But it can't be the right way to do this... can it?
Upvotes: 0
Views: 47
Reputation: 337637
You can use eq
to select an element by index. Try this:
$('.active').nextAll('.slide-item').eq(2).find('img').data('src');
There may still be a better method of achieving this, but without seeing your HTML it's hard to advise you.
Upvotes: 3