JSFiddle - React, Tailwind, and code Playground

HTML

<button id="btnAdd">Add Button</button>
<div id="container">
    <button class="alert">Alert</button>
    <button class="alert">Alert</button>
</div>

JavaScript

$(function(){
    //Whenever a button with class "alert" is clicked, alert "Hi"
    $('.alert').click(function(){alert('hi')});
    
    //Whenever "Add Button" is clicked, add a new alert button
   $('#btnAdd').delegate('click', function(){
         $('#container').append('<button class="alert">Alert</button>');
    });  
});