Directional ...">

In an iframe how to "unfold" span tags

how to expand span tags in an Iframe.

<span id="trans001" class="newtext">Directional</span>

      

I tried to uninstall with this $('iframe').contents().find(".newtext").unwrap();

If remove()

means it works, but content is removed as well. I want to save the text.

Thanks in advance.

+3


source to share


1 answer


You can use replaceWith instead .

$('iframe').load(function () {
    var $newText = $('iframe').contents().find(".newtext");
    $newText.replaceWith( $newText.text() )
});

      



The window load event is executed a bit later when the full page is fully loaded, including all frames, objects, and images.

+1


source







All Articles