Skip to main content

How to alter SVG-element on a web-page with contebnt from a new file?

I use SVGInject to load svg-images inline:

<img src="image1.svg" id="changeme" onload="SVGInject(this)" />

This works like a charm, and the image can be moved, rotated etc.
But is it possible to later "change" the image maybe?

document.getElementById('changeme').src = 'image2.svg';
SVGInject(document.getElementById('changeme'));

This does NOT work. Should the object be reloaded? Or the original destroyed and a new created...

cheers

Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW

Comments