JSFiddle - React, Tailwind, and code Playground

by cubicalmonkey

HTML

<ul id="fos">
    <li id="li1"></li>
    <li id="li2">beer</li>
    <li id="li3"></li>
    <li id="li4"></li>
    <li id="li5"></li>
</ul>

JavaScript

$('ul').each(function () {
    alert($(':nth-child(2)', $(this)).text());
});