JSFiddle - React, Tailwind, and code Playground
HTML
<div id="cloneMe">
<p>I am content inside of this container, and I'd like to be cloned.</p>
</div>
<br />
<a id="cloneBtn" href="javascript:void(0);">Show Clone</a>
<br />
<a id="replace" href="javascript:void(0);">Show Dynamic Content</a>
JavaScript
$(document).ready(function() {
var domCloneMe = $('div#cloneMe'),
cloned = domCloneMe.children().clone(),
domCloneBtn = $('a#cloneBtn'),
domeReplaceBtn = $('a#replace');
domCloneBtn.click(function() {
domCloneMe.html(cloned);
});
domeReplaceBtn.click(function() {
domCloneMe.html('<p>I would be dynamic content.</p>');
});
});