JSFiddle - React, Tailwind, and code Playground

by brianarn

HTML

<table>
    <tr unselectable="on">
        <th tabIndex="-1" id="th0">
            <div>
                <div>Foo</div>
            </div>
        </th>
    </tr>
</table>

JavaScript

var ths = document.getElementsByTagName('th');
for (var i = 0, l = ths.length; i < l; i++) {
    var node = ths[i];
    node.onfocus = function() {
        console.log('Focused: ' + this.id);
    };
    node.onblur = function() {
        console.log('Blurred: ' + this.id);
    }
}