JSFiddle - React, Tailwind, and code Playground
by CJ Ramki
HTML
<body>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button id="btn1">Detach all p elements</button>
<button id="btn2">Attach all p elements</button>
</body>
JavaScript
$(document).ready(function () {
var detached;
$("#btn1").click(function () {
detached = $("p").detach();
});
$("#btn2").click(function () {
$("body").append(detached);
});
});