JSFiddle - React, Tailwind, and code Playground

by Ivan Gerasimenko

HTML

<p class="blue">Click to toggle</p>
<p class="blue highlight">highlight</p>
<p class="blue">on these</p>
<p class="blue">paragraphs</p>

CSS

p {
    margin: 4px;
    font-size: 16px;
    font-weight: bolder;
    cursor: pointer;
  }
  .blue {
    color: blue;
  }
  .highlight {
    background: yellow;
  }

JavaScript

$( "p" ).click(function() {
  $( this ).toggleClass( "highlight" );
});