Question: I have been applying or changing the style for a CSS class in the javascript script, having a dojo f/w, like this,

```
this.sidePanel = query(".sidePanel", document.body())[0];
domStyle.set(this.sidePanel, {
    height: "25%",
    top: "334px"
});

```

This has worked fine but now I am having multiple nodes with similar CSS class. I wish to apply the new CSS style to the class and thereby all the nodes having the same class.

Is there some function in dojo which allows change in style to the CSS class directly without having to query for the node? Something like,

```
dojo.css.applyNewStyle('className', {'cssProperty': 'newValue'});

```

Answer: 
The `dojo/query` function returns a nodelist which you can operate on. If you also require the module `dojo/NodeList-dom` which extends `dojo/query`, you can do something like:

```
require(['dojo/query','dojo/NodeList-dom','dojo/domReady!'],function(query){
    query('.red').style('background-color','black'); 
});

```

I made a quick [jsfiddle](http://jsfiddle.net/jrkeller/rDdAG/) to demonstrate this. The [dojo reference guide](http://dojotoolkit.org/reference-guide/1.9/dojo/NodeList-dom.html) has a list of additional methods you can call on a nodelist, including adding a css class, which might be what you want (if your new css values are static rather than dynamic).
And if you don't want to include the dojo/NodeList-dom module, you can still do this :

```
query(".sidePanel").forEach(function(node){ domStyle.set(node, { height: "25%", top: "334px" })});

```

...but yeah, dojo/NodeList-dom is more concise :-)