Trying to add text into an editable div that is in an iframe

Started by
1 comment, last by JoeJ 1 year, 5 months ago

I have an iframe, it links to an HTML file that has a div that can be edited, I am trying to add content to that div, though all that I have tried hasn't worked.

Here is the iframe:

<div><div id="testing" contenteditable></div></div>

Of course, there is more in the HTML file the iframe displays, but the rest isn't important. So here is the code that I've tried:

function timpin() {
    var iframe = document.getElementById("textField");
    var elmnt = iframe.contentWindow.document.getElementById("testing");
    elmnt.innerHTML += "timpin ";
}

I do believe that it should work, but it isn't and I can't find out why.

– Erik P. Kountzman - Owner - of - Airent Animation Entertainment --

Advertisement

I've long forgotten all the web dev things. But i assume to edit an external webpage in an iframe, the only way is to edit the html of said webpage itself (on it's server where it comes from).

This topic is closed to new replies.

Advertisement