JSFiddle - React, Tailwind, and code Playground

HTML

<div id="hello"><p>Some content here</p></div>

JavaScript

$(function() {
    var $div = $("#hello");
    var html = $div.html();
    var checking = setInterval(function() {
        var newhtml = $div.html();
        if (html != newhtml) {
            myCallback();
            html = newhtml;
        }
    },100);
    
    function myCallback() {
        alert('content changed!');
        // if you only want it to fire once, uncomment the following:
        // clearInterval(checking);
    }
    
    // demo purposes:
    setTimeout(function() {
        $div.html('<ul><li>This is totally different!</li></ul>');
    }, 5000);
});