JSFiddle - React, Tailwind, and code Playground

by Jiff Pom

HTML

<div id="blog">
    <div class="postContent">
        <img src="img.png" alt="Keep this one"/>
        <img src="img.png" alt="REMOVE this one"/>
        <img src="img.png" alt="REMOVE this one"/>
        <img src="img.png" alt="REMOVE this one"/>
    </div>
    <div class="postContent">
        <img src="img.png" alt="Keep this one"/>
        <img src="img.png" alt="REMOVE this one"/>
        <img src="img.png" alt="REMOVE this one"/>
        <img src="img.png" alt="REMOVE this one"/>
    </div>
    <div class="postContent">
        <img src="img.png" alt="Keep this one"/>
        <img src="img.png" alt="REMOVE this one"/>
        <img src="img.png" alt="REMOVE this one"/>
        <img src="img.png" alt="REMOVE this one"/>
    </div>
</div>

JavaScript

$('.postContent').each(function(){
$(this).children('img:nth-child(n+2)').remove();
});