JSFiddle - React, Tailwind, and code Playground
by Michele Marcucci
HTML
<div>
<ul class="togle" data-id="1">
<li class="myview active"> one </li>
<li class=" myview">two</li>
<li class="myview" > three </li>
</ul>
</div>
<div>
<ul class=" togle " data-id="2 ">
<li class="myview">one</li>
<li class="myview" > two </li>
<li class="myview active">three</li>
</ul>
</div>
CSS
.myview {
background-color: #eee;
}
.active {
background-color: #FF0000;
}
JavaScript
$('.myview').click(function (e) {
e.preventDefault();
console.log('hello');
$(this).toggleClass('active');
});