我有以下输出:
<section class="group">
<div class="header">Header 1</div>
<div class="item">item1</div>
<div class="item">item2</div>
<div class="item">item3</div>
</div>
</section>
<section class="group">
<div class="header">Header 2</div>
<div class="item">item1</div>
<div class="item">item2</div>
<div class="item">item3</div>
<div class="item">item4</div>
<div class="item">item5</div>
</div>
</section>
我想用 jQuery 告诉我.item
每个<section>
. 目前正在尝试这个,但它没有给我正确的数字:
$('section.group').each(
function() {
alert($(this).length);
}
);