0

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,

TheBoubou
  • 19,487
  • 54
  • 148
  • 236
  • 1
    Please flow this link it might resolve your problem https://stackoverflow.com/questions/31808185/how-to-delete-html-elements-in-an-iframe-using-javascript – Anil Samal Apr 29 '22 at 08:05

1 Answers1

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

Olaf
  • 1,038
  • 8
  • 20