2
I have a list of images, and I need to return a value of these images to then assign some commands. The problem is that in some <li>
there will be a class called off
and needs to be "discarded" from the order.
Code exemplifying:
<ul>
<li class="off">
<img src="image1.jpg" class="imgx" />
</li>
<li>
<img src="image1.jpg" class="imgx" />
</li>
<li class="off">
<img src="image1.jpg" class="imgx" />
</li>
<li class="off">
<img src="image1.jpg" class="imgx" />
</li>
<li>
<img src="image1.jpg" class="imgx" />
</li>
</ul>
I mean, I need to list the <img>
that are not inside the <li class="off">
.
I tried something like:
var teste = $('li:not(:has(.off)) > img.imgx').eq(1).attr('src');
But it seems you’re not "excluding" the classy ones off
.
Solved! I switched to just
:not( )
and it worked! Thank you so much :D– Ricardo