JSFiddle - React, Tailwind, and code Playground
by Softlink
HTML
<div class="ops">
<div class="opa"></div>
</div>
CSS
.ops{
width: 300px;
height:: 300px;
padding: 50px;
margin: 50px;
background: #ccc;
}
.opa{
width: 100px;
height: 200px;
background: #222;
}
JavaScript
$(document).ready(function(){
$('div.opa').each(function(){
if($(this).closest('div.ops').length){
$('div.ops').css('background', 'red');
}
});
});