var container_div = document.getElementById('id_of_container_div'); var count = container_div.getElementsByTagName('div').length;