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($) {
    $.fn.changeElementType = function(newType) {
        var attrs = {};        
        $.each(this[0].attributes, function(idx, attr) {
            attrs[attr.nodeName] = attr.nodeValue;
        });

        this.replaceWith(function() {
            return $("<" + newType + "/>", attrs).append($(this).contents());
        });
    }
})(jQuery);


$("b.abc").changeElementType("h1");