JSFiddle - React, Tailwind, and code Playground

HTML

<div id="fish">
    
</div>

JavaScript

$('#fish').on('click', '.button', function(){
    console.log(this.id);
});

$('#fish').append($('<input type="button" class="button" value="1" id="button1" />'));
$('#fish').append($('<input type="button" class="button" value="2" id="button2" />'));
$('#fish').append($('<input type="button" class="button" value="3" id="button3" />'));