이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 함께 해서 번역을 마치도록 도와 주세요!
Node.children
is a read-only property that returns a live HTMLCollection
of the child elements of Node
.
Syntax
var elList = elementNodeReference.children;
elList
is a HTMLCollection
, which is an ordered collection of DOM elements that are children of elementNodeReference
. If there are no element children, then elList
contains no elements and has a length
of 0
.
Example
// pEl is a reference to a <p> element var elementChildren = pEl.children; for (var i = 0; i < elementChildren.length; i++) { console.log(elementChildren[i].tagName); // NOTE: elementChildren is a live list, adding or removing children from pEl // will change the members of elementChildren immediately }
Specification
Specification | Status | Comment |
---|---|---|
DOM The definition of 'ParentNode.children' in that specification. |
Living Standard | Initial definition. |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Edge | Opera | Safari |
---|---|---|---|---|---|---|
Basic support (on Element ) |
1.0 | 3.5 (1.9.1) | 9.0 [1] | 38.0 | 10.0 | 4.0 |
Support on Document and DocumentFragment |
29.0 | 25.0 (25.0) | No support | No support | 16.0 | No support |
Support on SVGElement |
(Yes) | (Yes) | No support | No support | ? | No support |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support (on Element ) |
(Yes) | 1.0 (1.9.1) | (Yes) | (Yes) | (Yes) |
Support on Document and DocumentFragment |
(Yes) | 25.0 (25.0) | No support | 16.0 | No support |
[1] Internet Explorer 6, 7 and 8 supported it, but erroneously includes Comment
nodes.
See also
- The
ParentNode
andChildNode
interfaces.
문서 태그 및 공헌자
태그:
이 페이지의 공헌자:
jonkee,
vedmack,
Robg1,
fscholz,
Prome,
ziyunfei,
danburzo,
Kartik_Chadha,
teoli,
Krinkle,
Sheppy,
Dan-Dascalescu,
fryn,
Philip Chee,
paul.irish,
janmoesen
최종 변경:
jonkee,