JSFiddle - React, Tailwind, and code Playground
HTML
<div>Hello</div>
<div id="foo" style="display:none">
<iframe id="bar" src="about:blank"></iframe>
</div>
<div>World</div>
<input type="button" value="load iframe" onclick="loadiframe()"/><br/>
<input type="button" value="replace iframe" onclick="replaceiframe()"/>
JavaScript
function loadiframe() {
$('#foo').show();
$('#bar').attr('src', 'http://google.com');
}
function replaceiframe() {
$('#foo').show();
$('#foo').html('<iframe src="http://google.com"></iframe');
}