i use innerHTML to add svg element,it works fine in chrome but in firefox it can not display; thanks so much for any ansower
A workaround is to add the innerHTML code as HTML, and not SVG. You can do that simply by using a Replace: with And wrap your This should work in both Chrome and Firefox. Here's a JSFiddle.) in your HTML code as the placeholder, and insert the full SVG via
innerHTML
.
innerHTML
string within an element:
var svg = document.getElementById('container');
svg.innerHTML = '';