vjdhama
vjdhama

Reputation: 5058

Get class of selected svg element in d3

How do i use instance of <rect> of a svg to get it's class?

I have to remove lines which have same class as the clicked <rect>.

I tried using selection.class() which obviously didn't work nor did selection.classed() help.

Upvotes: 8

Views: 11496

Answers (1)

Camron_Godbout
Camron_Godbout

Reputation: 1633

when using d3 I have found this works

selection.attr("class");

Upvotes: 12

Related Questions