I am trying to filter for a specific word ("no-image") in my src image, and if it returns true, I want to delete that particular image, but save the rest of the images.
This is my conclusion:
<div class="product">
<div class="image">
<img src="mytee-red.jpg">
<img src="mytee-blue.jpg">
<img src="mytee-black.jpg">
<img src="mytee-no-image.jpg">
</div>
</div>
This is what I have tried so far, but can't get it to work:
var keyword = "no-image";
$(".product .image img").filter(function(index) {
if ($(this).attr("src") == keyword) {
$(this).remove();
}
});
Any help would be great !!!
source
share