开发者

Get number of elements within a number of the same elements

开发者 https://www.devze.com 2022-12-18 23:22 出处:网络
I hope I can word this okay. I have multiple divs all called \'.collapse-conten\' and within each of these I have a table called \'.collapseTable\'. What I would like to do is check the number of row

I hope I can word this okay.

I have multiple divs all called '.collapse-conten' and within each of these I have a table called '.collapseTable'. What I would like to do is check the number of rows within each table.

I have 开发者_StackOverflowthis code right now...

var num = $(".collapse-content tr").size(); alert(num);

This obviously returns all rows in the page and the number of rows per div named '.collapse-content'

Can someone please help with this.

Many thanks, Cj


$(".collapse-content").each(function(){
    console.log($(this).find('.collapseTable tr').length);
});
0

精彩评论

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