[<<][webdev][>>][..]
Sun Aug 20 17:37:41 EDT 2017

SVG doesn't work with appendElement

https://stackoverflow.com/questions/16488884/add-svg-element-to-existing-svg-using-dom

var svg = document.getElementsByTagName('svg')[0]; //Get svg element
var newElement = document.createElementNS("http://www.w3.org/2000/svg", 'path'); //Create a path in SVG's namespace
newElement.setAttribute("d","M 0 0 L 10 10"); //Set path's data
newElement.style.stroke = "#000"; //Set stroke colour
newElement.style.strokeWidth = "5px"; //Set stroke width
svg.appendChild(newElement);




[Reply][About]
[<<][webdev][>>][..]