JSFiddle - React, Tailwind, and code Playground

HTML

<body>
  <div>Click here</div>
  <div>to iterate through</div>
  <div>these divs.</div>
</body>

CSS

div { color:red; text-align:center; cursor:pointer;
        font-weight:bolder; width:300px; }

JavaScript

$(document.body).click(function () {
      $( "div" ).each(function (i) {
        if ( this.style.color != "blue" ) {
          this.style.color = "blue";
        } else {
          this.style.color = "";
        }
      });
    });