Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
174
rated 0 times [  177] [ 3]  / answers: 1 / hits: 104979  / 11 Years ago, thu, july 11, 2013, 12:00:00

I am trying to append an HTML div inside an SVG, which I am trying to create a graph. I am trying to append it using the code below, but when I inspect element using Firebug, the div is shown inside rect element code, but it doesn't show up in the graph UI.



Is it something wrong with the method that I am trying or is it impossible to append a div inside an SVG?



    marker.append(rect)
.attr(width, 50px)
.attr(height, 50px)
.append(div)
.attr(id, function(d) {
return canvas_ + d.key.split( ).join(_);
})
.style(width, 50px).style(height, 50px);

More From » jquery

 Answers
13

You can't append HTML to SVG (technically you can with foreignObject, but it's a rabbit hole). Furthermore, visible elements in SVG can't be nested, so elements such as circle, rect, path and such can't have children elements.


[#77059] Wednesday, July 10, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
moriah

Total Points: 201
Total Questions: 100
Total Answers: 82

Location: Tuvalu
Member since Sun, Sep 4, 2022
2 Years ago
moriah questions
Mon, Aug 17, 20, 00:00, 4 Years ago
Tue, Nov 12, 19, 00:00, 5 Years ago
Wed, Aug 7, 19, 00:00, 5 Years ago
Tue, Jul 9, 19, 00:00, 5 Years ago
;