JSFiddle - React, Tailwind, and code Playground

by Rudolf Mankevich

HTML

<div id="first" style="width:100px"></div>
<div id="second" style="width:100px"></div>

JavaScript

async function injectSVGToElement(url, element) {
  const source = await fetch(url)
    .then((response) => response.text());
  element.insertAdjacentHTML('afterbegin', source);
}

injectSVGToElement('https://static.elfsight.com/icons/app-number-counter-book-multicolor.svg', document.querySelector('#first'));

injectSVGToElement('https://static.elfsight.com/icons/app-number-counter-clocks-multicolor.svg', document.querySelector('#second'));