JSFiddle - React, Tailwind, and code Playground
HTML
<h2>Unordered List</h2>
<ul>
<li>First list item</li>
<li>Second list item</li>
<li>Third list item</li>
<li>Fourth list item</li>
</ul>
<hr>
<h2>Another Unordered List</h2>
<ul>
<li>First list item</li>
<li>Second list item</li>
<li>Third list item</li>
<li>Fourth list item</li>
</ul>
CSS
.eq{
background: yellow;
}
.nth{
background: red;
}
JavaScript
$("li:nth-child(2)").addClass("nth");
$("li:eq(2), li:eq(6)").addClass("eq");