JSFiddle - React, Tailwind, and code Playground
CSS
td{
width:64px;height:64px;
}
JavaScript
function createTables(){
var l=n=9,a=[];
while(l--){
var hue=360/(n+1)*l|0;
a[l]='hsla('+hue+',100%,70%,1)';
}
document.body.innerHTML='<table id="example1"><tr><td style="background-color:'+a.join(';"></td><td style="background-color:')+'"></td></tr><table>';
}
function handler(e){
e.target.nodeName!='TD'||alert(e.target.style.backgroundColor+' on '+e.target.parentNode.parentNode.parentNode.id);
}
window.addEventListener('click',handler,false);
createTables();