JSFiddle - React, Tailwind, and code Playground

HTML

<button type="button" class="mybutton">Do it</button>

JavaScript

// delegate click events to things with class "mybutton" descended from the body tag
$('body').on('click','.mybutton',function() {
    alert('Done!');
});

//create a new button
var button = $('<button>').html('Again');

//add the class to the button
button.addClass('mybutton');

//add the button to the page
$('body').append(button);