- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
It only takes the id name of the tag and returns the number of elements in the tag.
In the following example, there are two elements in the div tag. Using the property "childElementCount" the number of elements was found out and the result is displayed in the output.
<html> <body> <div id="DIV"> <p>First element</p> <p>Second element</p> </div> <p id = "cou"></p> <script> var cou = document.getElementById("DIV").childElementCount; document.getElementById("cou").innerHTML = "number of elements :" +" "+ cou; </script> </body> </html>
First element Second element number of elements : 2
- Program to count number of elements in a list that contains odd number of digits in Python
- How to locate descendant elements of a particular type of elements in jQuery?
- Count of elements matching particular condition in Python
- How to check which list element contains a particular value in R?
- Python Program to Search the Number of Times a Particular Number Occurs in a List
- Get the number of rows in a particular table with MySQL
- Count number of subsets having a particular XOR value in C++
- How to extract strings that contains a particular substring in an R vector?
- How to locate all the descendant elements of a particular type of element?
- Python – Sort by a particular digit count in elements
- Check if an array contains all elements of a given range in Python