Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

D3 Equivalent to jQuery Attribute selector

Tags:

Does anyone know the d3 equivalent to jQuery attribute selector:

$('[attribute="name"]') 

I want to be able to use d3 methods such as .transition(). Thanks!

like image 570
mike Avatar asked Jun 15 '12 00:06

mike


1 Answers

It's the same in both D3 and jQuery; the underlying functionality is provided by the W3C Selectors API, so see the documentation on attribute selectors. For example, d3.select("[id=body]") is equivalent to d3.select("#body").

like image 147
mbostock Avatar answered Oct 30 '22 15:10

mbostock