JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<a href="#" id="chg-em">chg element</a>
</div>
<div class="local">
<p id="juice">juice</p>
</div>
JavaScript
$('#chg-em').on('click', function(e) {
$('.local').empty().append('<p id="orange-juice">orange juice<p>');
e.preventDefault();
});
$("#orange-juice").on('click', function() {
alert('ola');
});