HTML:标记语言
CSS:样式语言
JavaScript:脚本语言
Web API:编程接口
所有 Web 技术
学习 Web 开发
发现我们的工具
更好地了解 MDN
此功能已成熟,可跨多种设备和浏览器版本工作。它自 2018 年 4 月 起已在所有浏览器中可用。
Document.childElementCount 只读属性返回文档子元素的数量。
Document.childElementCount
要获取特定元素的子元素数量,请参阅 Element.childElementCount。
Element.childElementCount
一个数字。
document.children; // HTMLCollection, usually containing an <html> element, the document's only child document.childElementCount; // 1
加载中…
DocumentFragment.childElementCount