Ashima
Ashima

Reputation: 4824

How to select all types of child element inside an SVG using d3.js

To select all type of "rect" within an svg element we write this

svg.selectAll('rect')

But, here if i want to select everything within a SVG element including rect and circle and images etc and perform some common operation on all of them, how can I do that?

Upvotes: 1

Views: 1043

Answers (1)

go-oleg
go-oleg

Reputation: 19480

d3 uses css selectors so you want use an * (universal selector):

svg.selectAll('*')

Upvotes: 2

Related Questions