Skip to main content

Simple jQuery code snippet to remove an entire table column based on the column number. It also removes the table row heading associated with the removed column.

// remove the 1st column
$('#table').find('td,th').first().remove();

// remove the 1st column
$('table tr').find('td:eq(1),th:eq(1)').remove();

// remove the 2nd column
$('table tr').find('td:eq(1),th:eq(1)').remove();

// remove the nth column
$('table tr').find('td:eq(n),th:eq(n)').remove();