简体   繁体   中英

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:

function Delete(iframeName) {

    $('#' + iframeName)  

}

Thanks,

$("#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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM