Skip to content Skip to sidebar Skip to footer

Remove First Img In First Li Element With Jquery

I have an html like this

Solution 1:

You can select first li and then find first img inside it and remove it DEMO.

$('.products li').first().find('img').first().remove()

Another way to do this is

$('.products li:first img:first').remove()

Solution 2:

This works for me, where I look for the first direct child img of the first .featured-image element

jQuery (document).ready(function(){
    jQuery('.featured-image:first > img:first').remove();
});

Post a Comment for "Remove First Img In First Li Element With Jquery"