I'm starting development and I'm on a mission that's beating head and I do not know how to finish.
I need to change tag's <i>
by <svg><use></svg>
. This way I stop calling class
and step by calling id
, as shown below.
I would like to manipulate by js
. Where <i class="ico-nomedoicone">
is in HTML, change to
<svg class="icon"><use xlink:href="icons/icons.svg#icon-nomedoicone"/></svg>
Could someone help me with a code idea?
I thought of something like this ...
var i = document.querySelectorAll("i");
for(var i=0;i<=i.length;i++) {
if(i[s].className == "ico-") {
i[i].innerHTML = "<svg class='icon'><use xlink:href='icons/icons.svg#icon-italic'/></svg>";
}
}