JSFiddle - React, Tailwind, and code Playground

by YOUNY zhu

HTML

<div id="divParent1" class="parentDiv">
    MMMMM
    <div id="child1" class="childDiv1" style="position: absolute; top: 20px" >
        Child 1
    </div>
    <div id="child2" class="childDiv2" style="position: absolute; top: 100px">
        Child 2
    </div>
</div>

CSS

.childDiv1{
  border:1px solid blue;
 height: 80px;   
    margin:10px;
}
.childDiv2{
  border:1px solid blue;
 height: 50px;   
    margin:10px;
}

JavaScript

$('#child2').click(function(){
    $(this).css('background-color','#ff0000');
    $('#child1').hide();  
    $(this).css('top','20px');
});