JSFiddle - React, Tailwind, and code Playground

HTML

<table>
    <tr>
        <td>cell 1</td>
        <td>cell 2</td>
        <td>cell 3</td>   
    </tr>
</table>

JavaScript

var table = document.getElementsByTagName('table')[0];
table && table.onclick = function(e) {
    var target = (e || window.event).target;
    if (target.tagName in {TD:1, TH:1})
        target.setAttribute('style', 'background-color: #F00');
};