Removes a class or a list of classes from a DOM node.
Replaces one or more classes on a node if not present. Operates more quickly than calling dojo.removeClass and dojo.addClass.
Since Dojo 1.7,
dojo.replaceClass is exposed via the
replace method of the
dojo/dom-class module. An alias is kept in
dojo/_base/html for backward-compatibility.
The function takes up to three arguments:
- A DOM node or its node id (as a string).
- A String class name to add, or several space-separated class names, or an array of class names.
- A String class name to remove, or several space-separated class names, or an array of class names.
When using AMD format in a fully baseless application,
replace is accessed from the
Alternatively, you can load dojo base in AMD style and continue using
dojo.replaceClass in the
The following example replace all classes with addMe :