У меня есть таблица, и мне нужно скрыть/показать столбец таблицы, когда щелкните заголовок столбца, в котором скрывается столбец, и появится кнопка. Когда я нажимаю кнопку, я хочу показать hidden 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();
});