JSFiddle - React, Tailwind, and code Playground

by malonso

HTML

<div>
    <button id="create" onclick="createFra();return false;">Create Iframe</button>
    <button id="destroy" onclick="destroyFra();return false;">Destroy Iframe</button>
</div>

<div id="iframeContainer" style="background-color: Green">
</div>

JavaScript

function createFra() {
    for (var i = 0; i < 100; i++) {
        var y = document.createElement('iframe');
        y.id = 'dtest' + i;
        document.getElementById('iframeContainer').appendChild(y);
        y = null;
    }
}

function destroyFra() {
    for (var i = 0; i < 100; i++) {
        var iframe = document.getElementById('dtest' + i);
        iframe.parentNode.removeChild(iframe);
        iframe = null;
    }
}