JSFiddle - React, Tailwind, and code Playground
by TheBanana
HTML
<table>
<tr>
<th class="Title">ID</th>
<th class="Title">Color</th>
<th class="Title">Number</th>
</tr>
<tr>
<td>1</td>
<td>#990000</td>
<td>C001</td>
</tr>
<tr>
<td>2</td>
<td>#009900</td>
<td>C002</td>
</tr>
<tr>
<td>3</td>
<td>#FFFFFF</td>
<td>C003</td>
</tr>
<tr>
<td>4</td>
<td>#000000</td>
<td>C004</td>
</tr>
</table>
JavaScript
$(function () {
$('table th').each(function () {
$('<button>Hide</button>').appendTo($(this)).click(function () {
var column_index = $(this).parent().index()+1;
$('table td:nth-of-type('+column_index+'),table th:nth-of-type('+column_index+')').hide();
});
});
});