JSFiddle - React, Tailwind, and code Playground

by Matthew Day

HTML

<ul>
  <li>
    <p>Ana</p>
  </li>
  <li>
    <p>Beatrice</p>
  </li>
  <li>
    <p>Carlos</p>
  </li>
  <li>
    <p>David</p>
  </li>
</ul>

CSS

.active {
  color: crimson;
}

JavaScript

(function($) {
	$('li').on('click', function() {
  	let _target = $(this).children('p');
    _target.toggleClass('active');
  });
})(window.jQuery)