Get number of elements within a number of the same elements
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);
});
精彩评论