appending SVG string to dom
- by Wieringen
I'm trying to append a string of svg elements to the dom. This is my setup.
var oFragment = '';
for (var i = 0; i < 10; i++) {
oFragment += '<g><path id="note-1" d="M 6,3 84,6 c 0,0 -6,76 14,91 L 58,97 19,89 c 0,0 -24,-5 -13,-86 z" style="fill:#ffc835;" /></g> ';
}
Here is what i tried. It gives the following error: "parseXML is not defined"
var oSVG = document.getElementById("svg-wall").getSVGDocument();
var oNotes = oSVG.getElementById('notes');
oNotes.appendChild(parseXML(oFragment, document));
So my question is what am i doing wrong and is this even the best way to append a svg string to the dom?