I am new new to D3. I am trying to add input fields inside a svg element(rectangle) using d3.js. Please let me know if there is a way to do so.
1 Answer
You can only do this using svg:foreignObject, but you don't really want to use that since it's poorly supported. If you know that you're only going to deploy on browsers that support svg:foreignObject, then you can put any HTML inside of it. Otherwise, you'll need to use traditional DOM elements on a div on a z-index above your SVG and place them using CSS left: and top: in the way that you would place svg:rect elements using x and y.