DOM Properties

DOMTokenList.value

Reads or sets the underlying attribute string. Setting it replaces the attribute rather than merging tokens; use add or remove for targeted changes. Example result: new.

Formal Syntax & Structure

html syntaxhtml
list.value

Return Value

string

Token-list operation result.

Working Example

Example Snippethtml
<p>  Result:  <output id="result"></output></p><script>  const result = document.getElementById("result");  (async () => {  const el = document.createElement("div"); el.className = "card active"; const list = el.classList;  list.value = "new"; result.textContent = el.className;  })().catch(error => { result.textContent = "Error: " + error.name; });</script>
HTML Reference