replace

The replace JS DOMTokenList replaces token with newToken.

Returns true if token was replaced with newToken; otherwise false.

Throws a "SyntaxError" DOMException if one of the arguments is the empty string.

Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace.

Syntax

tokenlist.replace(token, newToken)

Parameters

token

A string.

newToken

A string.

Examples

1 · not replaced

2 · replaced

3 · return · false

4 · return · true

add

contains

item

length

remove

supports

toggle

value

Web Hypertext Application Technology Working Group (WHATWG)

Home Menu