JSFiddle - React, Tailwind, and code Playground

HTML

<div id="mycontainer">
    
</div>
<a href="#" id="btnAddControl">add control</a>

JavaScript

$(document).ready(function(){
    $("#mycontainer").bind("DOMSubtreeModified", NewControlAdded);
    
    $("#btnAddControl").click(function(){
        $("<span/>", {text : "hello", class:'w2'}).appendTo($("#mycontainer"));
    }); 
});




function NewControlAdded(){
    var ctrlAdded = $(this);
    //do some magic here
    alert("Text: " + ctrlAdded.text());
}