JSFiddle - React, Tailwind, and code Playground

HTML

<span id="theSpan"></span>


<div id="log"></div>

CSS

#log {
    color: #f77;
    margin: 20px 0;
    background: #eee;
    font-familty: monospace;
}

JavaScript

// create an observer instance
var target = $('#theSpan');
var observer = new WebKitMutationObserver(function(mutations) {
    mutations.forEach(function(mutation) {
        $('#log').text('input text changed: "' + target.text() + '"');
        //console.log(mutation, mutation.type);
    });    
});
observer.observe(target[0], { attributes: true, childList: true, characterData: true });
//observer.disconnect(); - to stop observing

// test case
setInterval(function(){
    target.text('hello world ' + Math.random() + '!!!');
},1000);