I have a html table that gets filled with information from a database. In order to show/hide columns I implemented the one line method in this post Hide/Show Column in an HTML Table
My code implementing the method looks like this:
$("#ID").change(function(){
if ($(this).is(':checked'))
{
$('th:nth-child(2)').hide("fast");
$('td:nth-child(2)').hide("fast");
} else {
$('th:nth-child(2)').show("fast");
$('td:nth-child(2)').show("fast");
}
});
That works great other than that when I go to show the column again in my table the cell width and stuff is messed up. I was wondering if there was any way to set it to expand?
Here is an photo of what is happening: