How to count number of elements present under a particular tag

How to find total number of elements present under a particular tag, for ex. if under a div tag there are 5 p elements, and i want to know total p elements.

you can use JS functions like getElementById(). Tell me do you want to count the nested

?