1

What's the way to move #content into the #wrapper?

index.html

<iframe id="my-iframe" src="./iframe.html"></iframe>
<div id="content"><p>content</p></div>

iframe.html

...
<div id="wrapper"></div>
...

The desired result:

...
<div id="wrapper">
    <div id="content"><p>content</p></div>
</div>
...

Both plain JS and jQuery will be okay, although plain JS is a bit preferably.

john c. j.
  • 725
  • 5
  • 28
  • 81

1 Answers1

1

You can't alter an iframe from a different domain, as that is the purpose of the element (to be unaltered by code on your page).

If you control both pages, you can see here: jQuery/JavaScript: accessing contents of an iframe

Community
  • 1
  • 1
Tyler
  • 11,272
  • 9
  • 65
  • 105