HTML DOMTokenList value

❮ The DOMTokenList Object

Examples

Get an element's classList as a string:

const list = element.classList;
let text = list.value;
Try it Yourself »

Add a "myStyle" class to an element:

const list = element.classList;
list.add("myStyle");
Try it Yourself »

Remove the "myStyle" class from an element:

const list = element.classList;
list.remove("myStyle");
Try it Yourself »

Description

The value property returns a DOMTokenList as a string.




Syntax

domtokenlist.value

Parameters

NONE

Return Value

Type Description
StringThe DOMTokenList as a string.

Browser Support

domtokenlist.value is a DOM Level 4 (2015) feature.

It is supported in all modern browsers:

Chrome Edge Firefox Safari Opera
Yes Yes Yes Yes Yes

domtokenlist.value is not supported in Internet Explorer 11 (or earlier).


❮ The DOMTokenList Object
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.