In HTML, I can clear a Is there an equivalent if I have an div.innerHTML = \"\";
If you're using jQuery, you can just do
$("#svgid").empty();
This deletes all child elements of the svg while leaving its other attributes like width and height intact.
use this? http://keith-wood.name/svg.html
there's also raphael: jQuery SVG vs. Raphael
I'd be tempted to trawl through and see who they're doing their .destroy()
methods.
If you want to keep defs of your svg as me use this
function clear(prnt){
let children = prnt.children;
for (let i=0;i<children.length;){
let el = children[i];
if (el.tagName!=='defs'){
el.remove();
}else(i++);
}
}