Firefox Tomorrow

web api instance property

Document: childElementCount property

View on MDN ↗

The Document.childElementCount read-only property returns the number of child elements of the document.

To get the number of children of a specific element, see childElementCount.

Value

A number.

Examples

document.children;
// HTMLCollection, usually containing an <html> element, the document's only child

document.childElementCount;
// 1

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also