HTML DOMTokenList length

❮ The DOMTokenList Object

Examples

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 »

Description

The length property returns the number of tokens in a DOMTokenList.

The length property is read-only.



Syntax

domtokenlist.length

Return Value

Type Description
NumberThe 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
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.