There is an iframe present in my HTML as below;
<iframe id="ifrContainer"></iframe>
I want to dynamically append form element inside this iframe. I have the following code to do that;
var iframeContainer = document.getElementById('ifrContainer');
var innerDoc = (iframeContainer.contentDocument) ? iframeContainer.contentDocument : iframeContainer.contentWindow.document;
innerDoc.body.innerHTML += '<form id="myForm"></form>';
The above code works fine in Chrome. But fails in IE.
It is giving error for innerDoc.body.innerHTML (saying it is null)
Not sure what I am doing wrong.
Note: I want to write into the iframe & not read the contents
This is how the function is called in my Ember app (the function has the iframe code)
Ember.run.scheduleOnce('afterRender', this, function() {
this.myIframeFunc();
})