HTML DOM NodeList values()
❮ The NodeList ObjectExamples
List the document's child nodes:
const list = document.body.childNodes;
for (let x of list.values()) {
text += x;
}
Try it Yourself »
List the names of the document's child nodes:
const list = document.body.childNodes;
for (let x of list.values()) {
text += x.nodeName;
}
Try it Yourself »
List the types of the document's child nodes:
const list = document.body.childNodes;
for (let x of list.values()) {
text += x.nodeType;
}
Try it Yourself »
Description
The values()
method returns an Iterator with the values from a
NodeList.
See Also:
Syntax
nodelist.values()
Parameters
NONE |
Return Value
Type | Description |
Object | An Iterator object with the values from the list. |
Browser Support
nodelist.values()
is a DOM Level 4 (2015) feature.
It is supported in all modern browsers:
Chrome | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes |
nodelist.values()
is not supported in Internet Explorer 11 (or earlier).
❮ The NodeList Object
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.