JSFiddle - React, Tailwind, and code Playground

HTML

<ul>
            <li>test 1</li>
            <li>test 2</li>
            <li>test 3</li>
            <li>test 4</li>
       </ul>

CSS

ul li:hover { background-color: black; }

JavaScript

$("ul li").click(function() {
    if ($(this).is(':hover')).alert('test');
});