JSFiddle - React, Tailwind, and code Playground

by hardiksondagar

HTML

<p>Hello</p>
<button id="switch">replace</button>

CSS

p {
    background-color: red;
}

div {
    background-color: yellow;
}

JavaScript

$(function(){
    $('#switch').bind('click', function(){
        //$('p').replaceWith('<div>divs rule!</div>');
        $('p').contents().unwrap().wrap('<div/>');
    });
});