HTML DOMTokenList value Property

Definition and Usage

The value property returns DOMTokenList as a string.

Example

Example 1

Get the element's classList as a string:

const list = element.classList;
let text = list.value;

Try It Yourself

Example 2

Add the "myStyle" class to the element:

const list = element.classList;
list.add("myStyle");

Try It Yourself

Example 3

Remove the "myStyle" class from the element:

const list = element.classList;
list.remove("myStyle");

Try It Yourself

Syntax

domtokenlist.value

Parameter

No Parameters

Return Value

Type Description
String String Representation of DOMTokenList

Browser Support

domtokenlist.value 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 (or earlier versions) does not support domtokenlist.value.

Related Pages

length Property

item() Method

add() Method

remove() Method

toggle() Method

replace() Method

forEach() Method

entries() Method

keys() Method

values() Method

DOMTokenList Object