jQuery method to get the number of child elements
- 2020-05-27 04:25:02
- OfStack
This example shows how jQuery gets the number of child elements. Share with you for your reference. The specific analysis is as follows:
// To obtain id=div1 The number of children under
$('#div1').children().length;
// To obtain id=div1 Under the span Number of elements
$('#div1').children('span').length;
I hope this article has been helpful to your jQuery programming.