JSFiddle - React, Tailwind, and code Playground

by Kondal Durgam

JavaScript

var tagString = "<div>I am a div node</div>";
var range = document.createRange();

// Make the parent of the first div in the document become the context node
range.selectNode(document.getElementsByTagName("div").item(0));
var documentFragment = range.createContextualFragment(tagString);
document.body.appendChild(documentFragment);