Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

ParentNode.children

Cette traduction est incomplète. Aidez à traduire cet article depuis l'anglais.

Node.children est une propriété seulement en lecture et renvoie en "live" l'élément enfant du nœud.

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
La définition de 'ParentNode.children' dans cette spécification.
Standard évolutif Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (on Element) 1.0 3.5 (1.9.1) 9.0 [1] 10.0 4.0
Support on Document and DocumentFragment 29.0 25.0 (25.0) Pas de support 16.0 Pas de support
Support on SVGElement (Oui) (Oui) Pas de support ? Pas de support
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (on Element) (Oui) 1.0 (1.9.1) (Oui) (Oui) (Oui)
Support on Document and DocumentFragment (Oui) 25.0 (25.0) Pas de support 16.0 Pas de support

[1] Internet Explorer 6, 7 and 8 supported it, but erroneously includes Comment nodes.

See also

Étiquettes et contributeurs liés au document

 Contributeurs à cette page : xavierartot
 Dernière mise à jour par : xavierartot,