javascript - In iframe how to "unwrap" span tags -


how unwrap span tags within iframe.

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

i tried remove using $('iframe').contents().find(".newtext").unwrap();

if remove() means works content removed. want retain text.

thanks in advance.

you can use replacewith instead.

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

the window load event executes bit later when complete page loaded, including frames, objects , images.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -