JSFiddle - React, Tailwind, and code Playground

HTML

<div class="box">
    
</div>

CSS

.box
{
    cursor: pointer;
    height: 100px;
    width: 100px;
    background: red;
}

JavaScript

$(document).ready(function(){
  $(".box").click(function(){
      
      if ($(".box").css("background-color") == "rgb(255, 0, 0)")
      {
          $(".box").html("Success!");
      }
  });
});