Skip to content
Related Articles

Related Articles

HTML | DOM childElementCount Property

View Discussion
Improve Article
Save Article
  • Last Updated : 12 Jul, 2022

The DOM childElementCount property is used to count the number of child element and return it. It counts only child element except for text and comment nodes. 



Where node is an object which represents the document or element. 

Return Value: It returns the number of child elements of the given element. 



<!DOCTYPE html>
        DOM childElementCount Property
            DOM childElementCount Property
    <p>Searching Algorithms</p>
    <ul id="parent">
        <li>Merge sort</li>
        <li>Quick sort</li>
    <button onclick="geek()">Click Here!</button>
    <p id="p"></p>
        function geek() {
            var doc =
            document.getElementById("p").innerHTML =
                  "No of entries: " + doc;


Before clicking the button:


After clicking the button: 


Supported Browsers: The browser supported by DOM childElementCount property are listed below:

  • Google Chrome 1.0
  • Edge 12.0
  • Internet Explorer 9.0
  • Firefox 3.5
  • Opera 10.0
  • Safari 4.0

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!