JSFiddle - React, Tailwind, and code Playground

HTML

<div>
</div>

JavaScript

$(document).on('DOMNodeInserted', '#myElement', function(){
    alert("#myElement added!");
});

setTimeout(function(){
    $("div").append('<div id="myElement"/>');
}, 2000);