JSFiddle - React, Tailwind, and code Playground

HTML

<input id="btn" type="submit" value="Add Item"> <ul/>

JavaScript

$("#btn").click(function(){
    $("<li />").html("item").appendTo("ul");
})

MutationObserver = window.MutationObserver || window.WebKitMutationObserver;

var observer = new MutationObserver(function(mutations, observer) {
    // fired when a mutation occurs
    console.log(mutations);
    // ...
});

// define what element should be observed by the observer
// and what types of mutations trigger the callback
observer.observe(document, {
    subtree: true,
    attributes: true,
    childList: true,
    characterData: true,
    attributeOldValue: true,
    characterDataOldValue: true
});