HTML DOMTokenList values() Method
- Previous page value
- Next page add()
- Go back to the previous level HTML DOMTokenList
Definition and Usage
The values() method returns an iterator (Iterator) with values from the DOMTokenList.
Example
Example 1
Get DOMTokenList from "demo":
let list = document.getElementById("demo").classList;
Example 2
List the keys of the list:
const list = document.body.childNodes; for (let x of list.keys()) { text += x; }
Example 3
List the values in the list:
const list = document.body.childNodes; for (let x of list.values()) { text += x; }
Syntax
domtokenlist.values()
Parameters
No parameters.
Return Value
Type | Description |
---|---|
Object | Iterator object containing the values in the list. |
Browser Support
domtokenlist.values() is a DOM Level 4 (2015) feature.
It is supported by all browsers:
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Internet Explorer 11 (and earlier versions) does not support domtokenlist.values().
Related Pages
- Previous page value
- Next page add()
- Go back to the previous level HTML DOMTokenList