Remove div if all img src is null inside div
Html code
<div class="add_pdt_img_nc">
<h5>Additional Images</h5>
<img border="0" src="" alt="">
<img border="0" src="" alt="">
<img border="0" src="" alt="">
<img border="0" src="" alt="">
</div>
I want to remove a div, has class add_pdt_img_nc if all src image is null
I've already tried
$(".add_pdt_img_nc img").each(function() {
if($(this).attr("src") == "") {
$(".add_pdt_img_nc").remove();
}
});
but it removes the div if first img src is null and doesn't check if other img src has value
+3
source to share
3 answers