replace( )


Replaces a custom CSS class of an element with a different custom CSS class.

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.

Method Declaration
Copy
Method Parameters
currentClassNamestringRequired

The custom class to replace.


newClassNamestringRequired

The new class to add.

Returns
Return Type:boolean
Was this helpful?
Yes
No