In HTML, I can clear a <div>
element with this command:
div.innerHTML = "";
Is there an equivalent if I have an <svg>
element? I can't find an innerHTML
nor innerXML
or even innerSVG
method.
I know the SVG DOM is a superset of the XML DOM, so I know I can do something like this:
while (svg.lastChild) {
svg.removeChild(svg.lastChild);
}
But this is both tedious and slow. Is there a faster or easier way to clear an SVG element?