Add content to an iFrame after 1 Secone

Test of adding content to an iFrame after 1 second.

by Helmut Granda

HTML

Add content to iframe inline after 1 second

<div id="iframeTest"></div>

JavaScript

var $frame = $('<iframe style="width:200px; height:100px;">');
$('#iframeTest').html($frame);
setTimeout(function() {
    var doc = $frame[0].contentWindow.document;
    var $body = $('body', doc);
    $body.html('<h1>Test</h1>');
}, 1000);