JSFiddle - React, Tailwind, and code Playground

HTML

<div class="parent1">
   <span class="child1">some text here</span>
    <span class="child1">some other text</span><br/>
        <span class="child">some other text</span><br/>   
   <span class="child1">yet more text</span>
</div>
<div class="parent2">
   <span class="child1">some text</span><br>
   <span class="child2">some text</span>
   
   <span class="child120">some text</span>
</div>

JavaScript

$(".parent1").children().filter(".child1").css({color:'Red'});