Move iFrame in the DOM using jQuery

Posted by Josh on Stack Overflow See other posts from Stack Overflow or by Josh
Published on 2010-06-12T19:38:36Z Indexed on 2010/06/12 19:42 UTC
Read the original article Hit count: 211

Filed under:
|

My overall aim is to create an editor which I can skin using jQuery UI (by creating a custom toolbar which uses integration calls), using TinyMCE.

Lets say I have a TinyMCE editor on a page. The actual editor is an iFrame contained inside a lot of horrible table code, which is also where the current (to be scrapped) toolbar is. I want just the iframe inside a div - ideally get rid of the table code.

So...I want to transform:

<table>
    <tr>
        <td><iframe id="xyz"></iframe></td>
    </tr>
</table>

into

<div id="test">
    <iframe id="xyz"></iframe>
</div>

So far, I've tried using:

$('#xyz').clone(true).appendTo('#test');

Which clones the iframe, but no content inside it.

Is there a way to make this work?

If not, can I somehow strip the table code from around the iFrame away?

If I cant do that, I'll think I'll have to keep the table code.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about tinymce