Thursday, May 19, 2011

jQuery - Tables - Show and Hide Columns

You can hide and show columns in a table by specifying a column index where 1 is the first column in the table.

function toggleColumn(column) {
  $('#iTable tr *:nth-child('+ column +')').toggle();
}

Note: iTable is the name of the HTML table.
Note: The * is used to ensure you show / hide both the TH and TD tags.
Unknown said...

Thank you very much friend, I was helpful. A greeting

Post a Comment