HTML DOMTokenList length
❮ The DOMTokenList ObjectExamples
Get the DOMTokenList from "demo":
let list = document.getElementById("demo").classList;
Try it Yourself »
Get the number of tokens (classes) in the list:
let number = list.length;
Try it Yourself »
Definition and Usage
The length
property returns the number of tokens in a
DOMTokenList.
The length
property is read-only.
See Also:
Syntax
domtokenlist.length
Return Value
Type | Description |
Number | The number of tokens in the The DOMTokenList. |
Browser Support
domtokenlist.length
is supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | 10-11 | Yes | Yes | Yes | Yes |
❮ The DOMTokenList Object