JSFiddle - React, Tailwind, and code Playground

HTML

<ul>
    <li>click me</li>
</ul>

CSS

li { cursor: pointer; }

JavaScript

$(function() {

    var v;

    $('ul li').click(function() {
        v = $(this).text();
        testFunction();
    });

    function testFunction() {
        alert(v);
    }

});