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
function jsChangeElementType(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
(function($) {
$.fn.changeElementType = function(newType) {
jsChangeElementType(this[0],newType);
}
})(jQuery);
$("b.abc").changeElementType("h1");