13
rated 0 times
[
15]
[
2]
/ answers: 1 / hits: 48604
/ 13 Years ago, mon, november 21, 2011, 12:00:00
How do I create an SVG element with JavaScript? I tried this:
var svg = document.createElement('SVG');
svg.setAttribute('style', 'border: 1px solid black');
svg.setAttribute('width', '600');
svg.setAttribute('height', '250');
svg.setAttribute('version', '1.1');
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
document.body.appendChild(svg);
However it creates an SVG element with zero width and zero height.
More From » svg