JSFiddle - React, Tailwind, and code Playground

HTML

<b class="abc" style="background-color:red; ">Change <i>here</i>!!</b>

<b style="background-color:#FFA; ">NO CHANGES HERE</b>

CSS

h1 {color:blue; font-size:22pt}

JavaScript

var ele1 = document.getElementsByTagName('b')[0];

function changeElementType(element,newtype) {
    
var new_element = document.createElement(newtype),
    old_attributes = element.attributes,
    new_attributes = new_element.attributes,
    child = element.firstChild;

for (var i = 0, len = old_attributes.length; i < len; i++) {
    new_attributes.setNamedItem(old_attributes.item(i).cloneNode());
}

do {
    new_element.appendChild(child);
} while (child = child.nextSibling);

element.parentNode.replaceChild(new_element, element);
}  //func


changeElementType(ele1,'h1');