How to get the count of child elements of an element using JavaScript?
Originally posted here!
To get the count of child elements inside a parent element, You can use the
childElementCount
property in the DOM element in JavaScript.
Let's say we have a div element with some paragraph elements inside it like this,
<div>
...
melvingeorge-me.hashnode.dev2 min read