JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<p>Paragraph #1</p>
</div>
<div>
<button id="add">Add Elements</button>
</div>
<script type="text/javascript">
var n = 1;
$('#add').click(function() {
$('#container').append('<p>Paragraph #' + ++n + '</p>');
});
$('#container').on('click', 'P', function() {
alert($(this).text());
});
</script>