JSFiddle - React, Tailwind, and code Playground
HTML
<div></div>
JavaScript
//extend default .append() causing it to trigger an event
(function ($) {
var origAppend = $.fn.append;
$.fn.append = function () {
return origAppend.apply(this, arguments).trigger("append");
};
})(jQuery);
//bind the event to the contain you wish to have this behaviour
$("div").bind("append", function () {
alert($(this).html());
});
//append as normally triggers the function above.
$("div").append("<span>Hello World</span>");