This module provides function that allows you to manipulate CSS classes of DOM elements.
To be able to use the dom-class module we need to load it as fallow :
require(["dojo/dom-class"], function(domClass){
// Write code here
});
This function checks if a node contains a specific class
Usage
if (domClass.contains("someId", "className")){
// do something if it contains
}
This function allows you to add CSS Classes to a DOM node without duplication.
Usage
domClass.add("someId", "className");
This function allows you to remove CSS Classes from a DOM node.
Usage
domClass.remove("someId", "className");
This function allows you to remove classes and replace it with other classes.
Usage
domClass.replace("someId", "addedClassName", "removedClassName");
This function allows you to remove a class if it exist, or add it if it doesn't exist.
Usage
domClass.toggle("someId", "className");