Home >Web Front-end >JS Tutorial >jquery gets the number of identical sub-elements under an element code_jquery
For example, the following html code needs to get the number of a elements under the P element:
<p id="father"> <a></a> <a></a> <a></a> <a></a> <a></a> …… <a></a> </p>
We can write like this:
$("#father a").length