0
我有一个表格,当点击标题列隐藏列和按钮时,我需要隐藏/显示表格列。单击按钮时,我想显示隐藏coloumn我该怎么做? 在这里看到我的代码http://jsfiddle.net/9QkVd/29/。如何在单击按钮时显示隐藏列
感谢
$(function() {
$('table tbody tr:odd').addClass('alt');
$('table tbody tr').hover(function() {
$(this).addClass('hover');
}, function() {
$(this).removeClass('hover');
});
});
$('tr th:gt(0)').click(function() {
var index = (this.cellIndex + 1);
var cells = $('table tr > :nth-child(' + index + ')');
cells.toggleClass('hide');
if ($(this).hasClass('hide')) {
$(this).find('span').html('<b>+</b>');
}
else {
$(this).find('span').html('<b>-</b>');
}
if ($('table tr > th:not(.hide)').length)
$('table').removeClass('hide');
else
$('table').addClass('hide');
$('.btnAssociate').show();
});
$('.btnAssociate').click(function()
{
$('.btnAssociate').hide();
});