I\'m trying to get the widths of a bunch of text elements I have created with d3.js
text
This is how I\'m creating them:
var nodesText = svg.sel
You can use getBoundingClientRect()
getBoundingClientRect()
Example:
.style('top', function (d) { var currElemHeight = this.getBoundingClientRect().height; }
edit: seems like its more appropriate for HTML elements. for SVG elements you can use getBBbox() instead.