JSFiddle - React, Tailwind, and code Playground

by Weston Ruter

HTML

<p><label>HTML: <input type="html" value="I am so &lt;b>BOLD&lt;/b>"></label></p>
<p><button autofocus>DO IT</button></p>

JavaScript

function createIFrame(innerHTML){
    var iframe = document.createElement('iframe');
    iframe.src = "about:blank";
    document.body.appendChild(iframe);
    var win = iframe.contentWindow;
    win.document.write(innerHTML);
    win.document.close();
}

document.querySelector('button').addEventListener('click', function(){
    createIFrame(document.querySelector('input').value);
}, false);