JSFiddle - React, Tailwind, and code Playground

HTML

<div>test</div>

JavaScript

var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.text = 'alert("test");';
$('div')[0].appendChild(script);