score:56

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.

score:39

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