Reputation: 1331
I'm trying to change the color of a node with a specific ID in D3, depending on what the user selects in a survey. I have this line of code:
$("#" + type).find("path, circle").attr("fill", "#333333");
where "type" is the name of the node I want to target (this name could change depending on the survey options selected, obviously). Looking at the console, the correct node is selected, but I just can't change the color. I've also tried .style("fill","#333333") instead of .attr("fill", #333333), but nothing seems to work!
Upvotes: 1
Views: 1567
Reputation: 32327
the d3 way is this:
d3.select("#" + type).select("circle").style("fill", "#333333");
Upvotes: 1