Monday, September 28, 2009

[jQuery] Removing a table column

Hello,

I have a problem with removing/toggling a table column.

I have the below function that works perfectly in FF3+, Chrome, Safari
but fails in IE7.

$.fn.toggleTableColumn = function(column){
$('tr td:nth-child('+column+'), tr th:nth-child('+column+'),
col:nth-child('+column+')', this).toggle();
};

The problem in IE7 is that is removes the column it is meant to but it
also removes the column directly to the right as well.

Both re-appear on the 're-toggle'

Has anybody seen this behaviour before. I have DebugBar in IE but
it's not helping too much. The missing second table colum still
appears in the DOM, there just appears to be difficulty displaying it.

I can paste an empty table example in here if it helps.

Thanks in advance for any thoughts.

No comments: