Reputation: 1937
I am trying to get the offsetParent value from d3.select(this) -- (this is the container).
d3.select(this) returns:
[Array[1]]
0: g
offsetParent: div#divID
This is from the console.log() in chrome, each row is within the previous. How do I get this offsetParent div ID?
Preferably, I would like to do something like:
d3.select(this).select("g").select("offsetParent").attr("id")
Upvotes: 0
Views: 381
Reputation: 14589
d3.select(this)
returns the d3 selection. You will have to use d3.select(this).node()
to get the dom element.
d3.select(d3.select(this).select("g").node().offsetParent).attr("id")
Upvotes: 3