JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<tr>
<th>One</th>
<th>Two</th>
<th>Three</th>
</tr>
<tr>
<td>Apples</td>
<td>1lb</td>
<td>Red</td>
</tr>
<tr>
<td>Pears</td>
<td>3lb</td>
<td>Green</td>
</tr>
<tr>
<td>Oranges</td>
<td>5lb</td>
<td>Orange</td>
</tr>
<tr>
<td>Bannanas</td>
<td>25lb</td>
<td>Yellow</td>
</tr>
</table>
JavaScript
/* Set all the cells in columns with THEHEADING in the heading to red */
columnTh = $("table th:contains('Two')"); // Find the heading with the text THEHEADING
columnIndex = columnTh.index() + 1; // Get the index & increment by 1 to match nth-child indexing
$('table tr td:nth-child(' + columnIndex + ')').css("color", "#F00"); // Set all the elements with that index in a tr red
columnTh.css("color", "#F00"); // Set the heading red too!