JSFiddle - React, Tailwind, and code Playground
HTML
<div>Click a button. See the assigned value here : <span id="status"></span></div>
<div id="button_out_1"></div>
CSS
button {
height: 50px;
width: 100px;
margin:10px;
}
JavaScript
function buttonClicked(e)
{
document.getElementById("status").innerText = this.id;
}
for(var i = 0; i < 16; i++)
{
var el = document.createElement("button");
el.onclick = buttonClicked;
el.id = i;
// Other options...
// el.dataset.id = i;
// el.param = {id : i };
document.getElementById("button_out_1").appendChild(el);
}