JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div id="initialdiv">this is the main div at first</div>
<div id="anotherdiv">this is another div at first</div>
<div>another div </div>
<script type="text/javascript">
var div = document.createElement("div");
div.id = "bodywrap";
// Move the body's children into bodywrap
while (document.body.firstChild)
{
div.appendChild(document.body.firstChild);
}
// Append bodywrap to the body
document.body.appendChild(div);
var superdiv = document.createElement("div");
superdiv.id = "superwrap";
// Move the body's children into superwrap
while (document.body.firstChild)
{
superdiv.appendChild(document.body.firstChild);
}
// Append superwrap to the body
document.body.appendChild(superdiv);
</script>
<script type="text/javascript">
alert("watch me NOT duplicate");
</script>
</body>