Is there a D3JS equivalent to Jquery's removeClass()
?
I want to remove all classes from a circle shape. I currently explicitly name and remove each class:
.on("click", function() {
d3.select("#circle" + i)
.classed("foo", false)
.classed("bar", false)
}
I could test for foo, bar, and remove only when present, but I want to anticipate as-yet unnamed classes for removal and make my code more efficient.
Is there a D3JS equivalent to Jquery's removeClass()
?
I want to remove all classes from a circle shape. I currently explicitly name and remove each class:
.on("click", function() {
d3.select("#circle" + i)
.classed("foo", false)
.classed("bar", false)
}
I could test for foo, bar, and remove only when present, but I want to anticipate as-yet unnamed classes for removal and make my code more efficient.
Share Improve this question asked Dec 27, 2017 at 14:41 TimTim 95913 silver badges34 bronze badges1 Answer
Reset to default 8You could use d3.select("#circle" + i).attr("class", null)
to clear all classes in the selected elements.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744872436a4598341.html
评论列表(0条)