I want to konw how can I count the child elements under a given Jquery object. I know that ‘length’ and ‘size()’ returns the amount of children elements, but I need a function that also count the children’s children and so on. So if their is a ‘span’ tag, nested inside another ‘span’ and another ‘span’, the function should return 3.
Share
For a specific element type:
For all elements with a specific class:
For all elements inside an element:
Working example: http://jsfiddle.net/AlienWebguy/whxf2/