JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test" class="red">content</div>
CSS
#test{
display:block;
width:100px;
border:1px solid green;
padding:5px;
}
.red{color:red;}
JavaScript
var div = $('#test');
var span = $('<span>',{
id:div.attr('id'),
html:div.html(),
class:div.attr('class'),
style:div.attr('style')
});
div.replaceWith(span);