JSFiddle - React, Tailwind, and code Playground
by tonytlwu
HTML
<div id="target"></div>
JavaScript
// Attach an event listener
$(document).on('click', '.btn', function () {
alert('Clicked!');
});
// Add a button 2 seconds later
setTimeout(function () {
$('#target').html('<button class="btn">Button</button>')
}, 2000);