Document: childElementCount property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{ APIRef("DOM") }}
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 {{domxref("Element.childElementCount")}}.
Value
A number.
Examples
js
document.children;
// HTMLCollection, usually containing an <html> element, the document's only child
document.childElementCount;
// 1Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- {{domxref("Element.childElementCount")}}
- {{domxref("DocumentFragment.childElementCount")}}