JSFiddle - React, Tailwind, and code Playground
HTML
<input type='button' value='0'/>
<input type='button' value='0'/>
<input type='button' value='0'/>
<input type='button' value='0'/>
<input type='button' value='0'/>
JavaScript
var ins=document.getElementsByTagName('input');
for (var i=0;i<ins.length;i++){
ins[i].setAttribute('data-myvalue',i);
ins[i].addEventListener('click',
function(){alert(this.getAttribute('data-myvalue'));});
}