开发者

Counting hidden table rows using JQuery

I 开发者_如何学Gohave a a table with a couple of hidden rows. What I want to achieve is having it show a hidden row with each button click, is this possible?

I count the number of table rows using the following

var rowCount = parseInt($('#Table tr').length);

How do I count hidden table rows?


Try

$('#Table tr:hidden').length

:hidden selector


As stated by others, you can specify hidden elements in your selector with the :hidden selector.

$("#Table tr:hidden").length; //number of hidden <TR> elements

As for showing each one with each sequential click of a button, you could make use of the :first selector as well:

$(".showRow").click(function(){
    $("#Table tr:hidden:first").show();   
});

Demo: http://jsfiddle.net/J3QdQ/


It is possible through : hidden operator

$('#Table tr:hidden').length
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜