JSFiddle - React, Tailwind, and code Playground
HTML
<button id="add_button">Add Button</button>
<div id="buttons">
</div>
JavaScript
// jquery delegate event testing
var i = 0;
$('#add_button').on('click', function () {
$('#buttons').append('<button class="alert_button" data-num="' + i + '">alert: ' + i + '</button');
i = i + 1;
});
$('#buttons').on('click', '.alert_button', function () {
alert('The number is ' + $(event.target).data('num'));
});