I've used someone else's answer to get this.
Jquery:
$("input:checkbox:not(:checked)").each(function() {
var columnName = $(this).attr('name');
$('td:nth-child(' + columnName + '),th:nth-child(' + columnName + ')').hide();
});
$("input:checkbox").click(function() {
var columnName = $(this).attr('name');
$('td:nth-child(' + columnName + '),th:nth-child(' + columnName + ')').toggle();
});
HTML:
<input type="checkbox" name="1" checked="checked"/>
It works when I put values in the :nth-child(1) but not when I include the variable. Am I doing it wrong or am I using the wrong Jquery library.
Any help would be appreciated!