I was just wondering if you could help me please. I have the below code:
<li class="active">
<div class="holder">
<img src="#" data-name="test1">
</div>
</li>
<li>
<div class="holder">
<img src="#" data-name="test1">
</div>
</li>
<li>
<div class="holder">
<img src="#" data-name="test2">
</div>
</li>
<li>
<div class="holder">
<img src="#" data-name="test1">
</div>
</li>
I would like a method of looking at the current list item and the to look at the next one and then the next one until it finds the img with the name Test 2. I have managed to get the current element. And I have found out how I can get the next element. But not the next element dependant on its children.
Could anyone please help?
Thanks in advance!
EDIT
Hey all thanks for all of your answers. There is only one problem at the moment and I should of probably said before. See the code below:
<li class="active">
<div class="holder">
<img src="#" data-name="test2">
</div>
</li>
<li>
<div class="holder">
<img src="#" data-name="test2">
</div>
</li>
<li>
<div class="holder">
<img src="#" data-name="test2">
</div>
</li>
<li>
<div class="holder">
<img src="#" data-name="test2">
</div>
</li>
<li>
<div class="holder">
<img src="#" data-name="test1">
</div>
</li>
<li>
<div class="holder">
<img src="#" data-name="test2">
</div>
</li>
There could be many images named test2 but I only want to get the next image after the currently active image. For example it would skip the image test1