JSFiddle - React, Tailwind, and code Playground
HTML
<div id="content">
<p>This will be replaced</p>
</div>
<script id="replacement">
<p>This is the replacement!</p>
</script>
JavaScript
(function($) {
$.fn.render = function(htmlString) {
var selector = this;
selector.html(htmlString);
selector.trigger("render");
};
})(jQuery);
$(document).ready(function() {
$("#content").bind("render", function() {
alert("rendered");
});
$("#content").render($("#replacement").html());
});