Can't copy an iframe from one div to another div?

I am trying to copy an iframe to another div, its not working here is my code

<script type="text/javascript">
    $(document).ready(function () {
        setInterval(function () {
            if ($('#d1').html() != $('#d2').html()) {
                $('#d2').html($('#d1').html());
            }
        }, 4000);
    });
</script>

and

<div id="d1">some stuff<iframe src="http://www.w3schools.com/html/default.asp" id="iframe1"></div>
<div id="d2"></div>
+3
source share
2 answers

iframe closing tag was missing:

Check here

0
source

Your HTML is invalid ... <iframe>should be closed with </iframe>... after you fix it,

Working example

Note: executing this copy (i.e. $('div1').html($('div2').html()) causes duplication idsinside the document - this is again incorrect

+1
source

All Articles