php iframe add content
<script>
function createElementMY(){
var doc = document.getElementById('container');
var ifrDoc = doc.contentDocument;
var elem = ifrDoc.createElement("div");
elem.textContent = 'Test';
ifrDoc.body.appendChild(elem);
}
</script>
<iframe id="container" src="data:text/html,rawr"></iframe>
<button onclick="createElementMY()">Click me!</button>