JSFiddle - React, Tailwind, and code Playground

by yoowordpress

HTML

<img src="https://upload.wikimedia.org/wikipedia/commons/f/f8/Windows_logo_-_2012_%28red%29.svg" alt="Microsoft" width="350" />

CSS

svg {width: 350px; height: 350px;}

JavaScript

$(function(){

        var imgURL = $('img').attr('src');
    
        jQuery.get(imgURL, function(data) {
            // Get the SVG tag, ignore the rest
            var $svg = jQuery(data).find('svg');
    
    
  
            // Remove any invalid XML tags as per http://validator.w3.org
            $svg = $svg.removeAttr('xmlns:a');
            $svg.find('path').style('fill', '#000')
      
    
            // Replace image with new SVG
            $img.replaceWith($svg);
    
        }, 'xml');
    
 
});