3

I have svg with image tag:

<image style="overflow:visible;" width="28" height="28" id="Icon1" xlink:href="ALU41Blk.svg" transform=".... />

Now I change some atrributes(or load some other svg icon, doesn't matter):

var $img = $('#Icon1');
    var $iconURL = $img.attr('xlink:href');//or some other svg
    jQuery.get($iconURL, function (data) {
        var $svg = jQuery(data).find('svg');
        $svg.find('path').attr('fill', 'red');//until here everything works
        $img.replaceWith($svg);
    })

When I use replace, image is not shown. What function should I use to replace image file with data, I have loaded?

Simon
  • 1,955
  • 5
  • 35
  • 49

0 Answers0