JSFiddle - React, Tailwind, and code Playground

by _sir

HTML

<div id="container">
    <div id="keeper">Something to Keep</div>
    <div id="content">Something to change</div>
</div>
<button id="one">Swap</button>
<button id="two">Replace</button>

JavaScript

var $k = $('#keeper'),
    $c = $('#container');

function swapper() {
    $c.html("<p>some content</p>");
}

$('#one').on('click', swapper)
$('#two').on('click', function() {
    // Even though it comes later
    $c.prepend($k);
});