= { doAction: function() { $.post("/path", { success: function() { // obviously we cannot hijack this. // It's an anonymous function in another // anonymous function var html = "" html += "<div>" html += " <p>Pretend this is Dynamic</p>" html += "</div>" $("body").append(html); } }); } }
HTML node is inserted in it. This even can bubble all the way up to the document. document.querySelector(“.parent") .addEventListener("DOMNodeInserted", function(e) { if(e.target.classList.contains("child")) { var transformThis = e.target // do transformations here. } });