JSFiddle - React, Tailwind, and code Playground

HTML

<div class="not-ancestor">
    <input type="text" value="don't select this" />
    <input type="text" value="don't select this" />
    <input type="text" value="don't select this" />
    <input type="button" value="button" />    
</div>
<div class="not-ancestor">
    <div class="asdf">
        <div class="qwer">
            <input type="button" value="button" />
            <input type="text" value="don't select this" />
            <input type="text" value="don't select this" />
            <input type="text" value="don't select this" />
    </div>
    </div>
</div>
<div class="ancestor">
        <div>
            <input type="text" value="select this" />
            <input type="text" value="select this" />
        </div>
</div>

CSS

div{
    margin:5px;
}
.parent{
margin:25px;
}

JavaScript

$(document).ready(function(){
    
    $("div:not(.not-ancestor) > input[type='text']").css('color', '#FF1200');
});