如何使用JQuery获取列的状态?

时间:2012-01-25 17:03:32

标签: jquery

我的意思是,有没有办法知道列是否被隐藏?我刚学会用

隐藏它们
$('#tableG td:nth-child('+(index+1)+'), #tableG th:nth-child('+(index+1)+')').hide();

但现在我需要获得状态,是否有类似的内容:

if($('#tableG th:nth-child('+(index+1)+')').show() == true) { ... }

2 个答案:

答案 0 :(得分:4)

您想使用这种表示法:

$(element).is(":visible")

这样:

if($('#tableG th:nth-child('+(index+1)+')').is(":visible")) {...}

答案 1 :(得分:0)