JSFiddle - React, Tailwind, and code Playground
HTML
<div id="wrap">
<input type="text" id="input">
</div>
<button type="button" id="replace">
Replace
</button>
<div id="console">
</div>
JavaScript
$("#input").change(function() {
$("#console").append("change: " + $(this).val() + "<br>");
});
$("#wrap").on("change", "#input", function() {
$("#console").append("change delegated: " + $(this).val() + "<br>");
});
$("#replace").click(function() {
$("#wrap").html('<input type="text" id="input">');
});