JSFiddle - React, Tailwind, and code Playground

HTML

<html>
<body>
<div class="d1 xxx"></div>

<div class="d2 xxx"> </div>

<div class="d3 xxx"> </div>
</body>

</html>

JavaScript

$(document).ready(function () {
    var observer = new MutationObserver(function(mutations) {
      mutations.forEach(function(mutation) {
        if (mutation.attributeName === "class") {
          var attributeValue = $(mutation.target).prop(mutation.attributeName);
          console.log("Class attribute changed to:", attributeValue);
        }
      });
    });
    
    observer.observe(document.querySelector(".xxx"), {
      attributes: true
    });
   
});