JSFiddle - React, Tailwind, and code Playground
HTML
<span> one </span>
<span> two </span>
<span> two </span>
CSS
.red
{
background-color: red;
}
JavaScript
$("span").click(function() {
$(this).toggleClass("red");
});
var lastBodyHTML = "";
var changes = 0;
function test() {
if (lastBodyHTML == "") {
lastBodyHTML = document.body.innerHTML;
}
if (lastBodyHTML != document.body.innerHTML) {
changes++;
alert("CHANGE #" + changes);
lastBodyHTML = document.body.innerHTML;
}
window.setTimeout(test, 1000);
};
test();