167
rated 0 times
[
174]
[
7]
/ answers: 1 / hits: 96050
/ 12 Years ago, fri, november 2, 2012, 12:00:00
I have the svg as:
<g class=user title=Michael rel=tooltip transform = rotate(-12.364052661705784)translate(360) style=fill: #9467bd; ></g>
I want to add a class as the same as title. I tried
d3.selectAll('.user').attr('class','Michael');
But it replaced the original class. Then I tried
d3.selectAll('.user').classed('Michael',true);
It works! But now I want to return the class name with a function like
d3.selectAll('.user').classed(function(){return this.attr('title');},true);
It doesn't work. How can I do that?
Thanks
More From » jquery