JSFiddle - React, Tailwind, and code Playground

by moob

HTML

<table id="table">
    <tr>
        <th>zero</th>
        <th>one</th>
        <th class="me">two</th>
        <th>three</th>
     </tr>
     <tr>
        <td>first</td>
        <td>second</td>
        <td>third</td>
        <td>fourth</td>
     </tr>
     <tr>
        <td>first</td>
        <td>second</td>
        <td>third</td>
        <td>fourth</td>
     </tr>
</table>

CSS

.me {background-color:orange;}
.metoo {background-color:yellow;}

JavaScript

var columnIndex = $("#table tr th.me").index()+1;//zero-based whereas nth-child isnt
$("#table tr td:nth-child("+columnIndex+")").addClass('metoo');