Reputation: 77
Im trying to select all <path>
's but only ones that conatin a class that INCLUDES a str.
as an example if i have 3 elements
<h1 class="hello"/>
<h2 class="bye" />
<h3 class="fix" />
I want to be able to say everything with a class containing an e, change color to red.
which would make h1 and h2 red.
Im using d3.selectAll(path[class=*.${str}]
);
(Doing this with d3.selectAll(path:not([class=*.${str}
])`) seems to work for selecting everything without that class)
Upvotes: 1
Views: 83
Reputation: 2421
Like Pete said, your * is on the wrong side of the equal sign. You also don't need to add .
in your selector. Something like this should work for you:
d3.selectAll(`path[class*=${str}]`)
Upvotes: 3