JSFiddle - React, Tailwind, and code Playground
HTML
<div id='test'>hello</div>
<iframe id="myFrame" style="width: 100px; height: 100px;"></iframe>
JavaScript
var allMyCode = "<div id='test'>html code</div> <script type='text/javascript'>alert(document.getElementById('test').innerHTML);<\/script>";
$("#myFrame").contents().find("body").html(allMyCode);