Search...
replace( )
Replaces a custom CSS class of an element with a different custom CSS class.
Description
The replace()
function replaces a custom CSS class of an element with a different custom class.
If the currentClassName
is not one of the element's classes, the element's class list is not affected.
Returns true
if the replacement is successful.
Syntax
function replace(currentClassName: string, newClassName: string): boolean
replace Parameters
NAME
TYPE
DESCRIPTION
currentClassName
string
The custom class to replace.
newClassName
string
The new class to add.
Returns
Return Type:
boolean
Was this helpful?
Replace an existing class with a new class
Copy Code
1$w("#myElement").customClassList.replace("className1, className2");