JSFiddle - React, Tailwind, and code Playground
by anAgent
HTML
<div class="parent" id="SomeDiv">
<div id="Child1" class="child">First Child</div>
<div id="Child2"class="child" >Second Child</div>
<div id="Child3"class="child" >Thrid Child</div>
</div>
CSS
.parent{
background-color:#efefef;
padding:5px;
}
.parent .child {
background-color:white;
margin:10px;
padding:5px;
border: 1px solid black;
}
.parent .child:nth-child(2){
text-align:center;
background-color:yellow;
}
JavaScript
$('.child::nth-child(2)','#SomeDiv').click(function(){
alert('You clicked ' + this.id);
});