var element = document.getElementById("theElementId"); var numberOfChildren = element.getElementsByTagName('*').length