javascript - How to insert html in to svg element -
element formed if there exists within thehave markup
<g id="g-svg_el_obj921" style="top: 300px; left: 550px;"> <circle r="95.12" fill="rgb(50, 149, 196)" class="some_class" id="svg_el_obj921" priority="4" position="300_550" cx="550" cy="300"></circle> </g>
i need insert div
element g
or circle
element, this:
$('g').each(function(){ var feel_el = document.createelementns('http://www.w3.org/1999/xhtml', 'div'); var $feel_el = $(feel_el); $(this).append($feel_el); });
element formed seems not exist... can help?
all foreign content must child of <foreignobject>
element in svg. additionally <circle>
element can't have rendered children, <g>
element can.
so you'd have change function firstly creates <foreignobject>
element, gives element width , height , creates <div>
element , makes child of <foreignobject>
element, create markup looks this.
<g id="g-svg_el_obj921" style="top: 300px; left: 550px;"> <circle r="95.12" fill="rgb(50, 149, 196)" class="some_class" id="svg_el_obj921" priority="4" position="300_550" cx="550" cy="300"></circle> <foreignobject width="100" height="100"> <div> </div> </foreignobject> </g>
Comments
Post a Comment