I have a problem to remove only img class from active div :
<div class="thumb thumb-selected">
<img class="img-thumb BWFilter BWfade" src="100x100.jpg" alt=""><img crossorigin="anonymous" style="height: 100px; width: 100px; margin-top: 0px; margin-left: 0px;" class="img-thumb" src="3-100x100.jpg" alt=""></div>
I want to remove (BWFilter BWfade) class, only for this div (.thumb .thumb-selected), I'm trying with this jquery code:
$('.thumb .thumb-selected').find('.img-thumb img').removeClass("BWFilter BWfade");
the removeClass accepts more then one class to remove:
$('.thumb.thumb-selected > img.img-thumb').removeClass('BWFilter BWfade');
The >
- selector will only match when the img
is a direct child of your div.
Reference
.removeClass()
css - child-selector
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With