JSFiddle - React, Tailwind, and code Playground

HTML

<ul>
    <li></li>
    <li></li>
    <li class="test"></li>
</ul>

JavaScript

if ($("li.test").next().length > 0) {
    alert('there is a next!');
} else {
    alert('no next :(');
}