web api instance property
Element: childElementCount property
The Element.childElementCount read-only property
returns the number of child elements of this element.
Examples
let sidebar = document.getElementById("sidebar");
if (sidebar.childElementCount > 0) {
// Do something
}
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.