dojo - dojo tutorial dom-class in Dojo - coding dojo - dojo examples



This module provides function that allows you to manipulate CSS classes of DOM elements.

Initialization

To be able to use the dom-class module we need to load it as fallow :

domConstruct.place('<em> require(["dojo/dom-class"], function(domClass){
    // Write code here
})Dojo!</em>', greetingNode);

contains()

  • This function checks if a node contains a specific class

Usage

if (domClass.contains("someId", "className")){
     // do something if it contains 
 } 

add()

  • This function allows you to add CSS Classes to a DOM node without duplication.

Usage

domClass.add("someId", "className"); 

remove()

  • This function allows you to remove CSS Classes from a DOM node.

Usage

 domClass.remove("someId", "className");

replace()

  • This function allows you to remove classes and replace it with other classes.

Usage

domClass.replace("someId", "addedClassName", "removedClassName");

toggle()

  • This function allows you to remove a class if it exist, or add it if it doesn't exist.

Usage

domClass.toggle("someId", "className");

This dojo tutorial page provides you the following items dojo js tutorial , class dojo tutorial , dojo js , the dojo , dojo toolkit , learning dojo , dojo , what is a dojo , dojo programming , dojo javascript , dojo framework , define dojo , dojo require , dojo declare , dojo training , dojo xhr , dojo vs jquery , dojo examples , dojo application , dojo java , import dojo , dojo tree , dojo dom , call dojo , dojo ajax , dojo demo , dojo dojo , dojo json , dojo tutorial w3school , dojo widget , dojo full form , dojo jquery , dojo amd , dojo download , dojo library , dojo web , dojo tool , dojo build , coding dojo

Related Searches to dom-class in Dojo