Accepted answer

The most D3 way to do this would be to chain the selectors using the filter method:

var list1 = d3.selectAll(".mYc").filter(".101");

This won't work though because class names cannot start with a number. So you have to rename to something like "a101" and then you can do

var list1 = d3.selectAll(".mYc").filter(".a101");

See this fiddle.


Another way I have found to do this is to select both classes at the same time as a single string, for example:

var list1 = d3.selectAll(".mYc.a101")

It won't work if you add in a space in between, or add a comma in between (which selects things that have either class instead).

Related Query

More Query from same tag