100
rated 0 times
[
102]
[
2]
/ answers: 1 / hits: 49019
/ 13 Years ago, tue, february 14, 2012, 12:00:00
I'm trying to add a text element to the <g>
element in a SVG document using javascript
my code looks like this
function addText(x,y,val){
var newtxt = document.createElementNS(http://www.w3.org/2000/svg, text);
$newtxt = $(newtxt);
$newtxt.attr('x',x);
$newtxt.attr('y',y);
$newtxt.attr('font-size','100');
$newtxt.val(val);
$newtxt.appendTo($('g'));
}
but when I run it the text is not shown.
the element is added to the <g>
element, but the value is not set..
any ideas how to solve this??
More From » jquery