Reputation: 21
At least i want to count how many sections are in one article. If this doesn´t work with this elements, I also could use normal "div" tags instead. Sorry for my bad english.
<article>
<section>
<p>text</p>
</section>
<section>
<p>example</p>
</section>
</article>
Upvotes: 1
Views: 1526
Reputation: 171679
If you have more than one <article>
and are wanting to know how many are in each one:
$('article').each(function(){
var secCount = $(this).find('section').length;
});
Upvotes: 0
Reputation: 515
Try this:
<div>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
</div>
script:
var a=$("div p").length;
alert(a);
Upvotes: 0