jQuery statistics a method that specifies the number of child elements
- 2020-05-16 06:24:23
- OfStack
This article demonstrates an example of how jQuery counts the number of specified child elements. Share with you for your reference. The specific analysis is as follows:
jQuery can be passed > Access the child tags, and then get the number of child tags via size
<div id="foo">
<div id="bar"></div>
<div id="baz">
<div id="biz">
</div>
<span><span>
</div>
//jQuery code to count child elements
$("#foo > div").size()
I hope this article has been helpful to your jQuery programming.