JSFiddle - React, Tailwind, and code Playground
by andyw_
HTML
<body>
<p>Hello World! click <a href="#">here</a> to change the page dynamically and execute some scripts</p>
</body>
JavaScript
$(function() {
$('a').on('click', function() {
var iframe = createIframe('http://fiddle.jshell.net/doiks14/PS6qQ/3/show/');
var $iframe = $(iframe);
$('body').append(iframe);
$(iframe).on('load', function() {
console.log($iframe);
//$(document).find('head').empty().append($iframe.find('head').children());
//$(document.body).empty().append($iframe.find('body').children());
});
return false;
});
function createIframe(href) {
var iframe = document.createElement('iframe');
iframe.src = href;
return iframe;
}
});