Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Remove some element in iframe with jquery

In the code below, with jquery, I’d like remove element (and the child ‘li’) and after that add some code to the

Could you tell me how do this ?

<iframe id="myIframe">
    #document
    <html>
        <head>
        </head>
        <body>
            <div class="spinner" style="display:none;"></div>
            <ul>
                <li>
                    <p contenteditable="false">11111</p>
                </li>
                <li>
                    <p contenteditable="true"></p>
                </li>
            </ul>
        </body>
    </html>
</iframe>

I have a function for this :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

function Delete(iframeName) {

    $('#' + iframeName)  

}

Thanks,

>Solution :

$("#myIframe").contents().find("#mydiv").remove();

However, this assumes the browser is not blocking access to the iframe. If the iframe is hosted on another domain and has cross-domain security measures enabled it will not allow you to change the content in the iframe.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading