JSFiddle - React, Tailwind, and code Playground

by Santosh Thakur

HTML

<ul>
    <li>A</li>
    <li>B</li>
    <li>C</li>
    <li>D</li>
    <li>E</li>
</ul>

JavaScript

(function () {
    $('li').click(function () {
        $(this).each(function () {
            $('li').css('cursor', 'pointer');
            if ($(this).text() == 'A') {
                $(this).css('color', 'blue');
            }
            if ($(this).text() == 'B') {
                $(this).css('color', 'yellow');
            }
            if ($(this).text() == 'C') {
                $(this).css('color', 'Green');
            }
            if ($(this).text() == 'D') {
                $(this).css('color', 'orange');
            }
            if ($(this).text() == 'E') {
                $(this).css('color', 'pink');
            }
        });
    });

})();