Search notes:

DOM example: childElementCount

<!DOCTYPE html>
<html>
<head>
  <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
  <title>childElementCount</title>

  <style type="text/css">

    #out {
       margin-top: 20px;
       background-color: #fffaf0;
    }

  </style>

</head>

  <script type="text/javascript">
    function main() {

       var div = document.getElementById('theDiv');
       var out = document.getElementById('out'   );

       out.innerHTML = 'The DIV contains ' + div.childElementCount + ' children<br>';

    }
  </script>

<body onload='main();'>

  <div id='theDiv'>

    <div>First Child
        <div>First child within first child</div>
        <div>Second child within first child</div>
    </div>

    some text

    <div>Second Child</div>

    <div>Third Child</div>
  
  </div>

  <div id='out'></div>

</body>
</html>

Github repository about-Document-Object-Model, path: /Node/Element/childElementCount.html

See also

DOM examples

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759407975, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/web/DOM/examples/Node/Element/childElementCount(87): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78