JSFiddle - React, Tailwind, and code Playground

by yijiang

HTML

<div id="act1">first click</div> 
<div id="act2">second click</div>  

<ul>
    <li><div id="tos" class="white_content">  
    some text...
    </div></li> 

    <li><div id="tos" class="white_content">   
    other some text
    </div></li> 
</ul>

CSS

.white_content {
    display: none;
    position: relative;;
    width: 5%;
    height: 5%;
    padding: 24px;
    border: 16px solid orange;
    background-color: orange;
    z-index:1;
}

JavaScript

$('div[id^=act]').click(function(){
    var n = parseInt(this.id.substring(3), 10);
    $('li').eq(n-1).find('.white_content').fadeToggle(400);
});