简体   繁体   English

TinyMCE编辑器在获取appendTo后无法正常工作

[英]TinyMCE editor not working after getting appendTo

I use TinyMCE in one of my website and I need to change a <div> to another parent without losing the input of the textarea(TinyMCE Editor) inside the <div> . 我使用TinyMCE的在我的网站之一,我需要更改<div>到另一个父不失里面的文本区域(TinyMCE的编辑器)的输入<div> I tried using appendTo but not working. 我尝试使用appendTo但无法正常工作。 Here's what I tried https://jsfiddle.net/y6172pua/ 这是我尝试过的东西https://jsfiddle.net/y6172pua/

Is there any solution? 有什么解决办法吗?

Thanks :D 感谢:D

AppendTo accepts HTML, not an element. AppendTo接受HTML,而不是元素。 For appendTo try with this 对于appendTo尝试这个

$($('#z1').html()).appendTo('#t2');

You can try simple with append 您可以尝试简单的append

$('#t2').append($('#z1'));

The problem would be that the editor does not work afterwards because it was not initialized. 问题在于编辑器之后由于未初始化而无法工作。 You should add another box to the second div, intialize the TinyMCE editor on it, get the content from the first one and add it to the second one. 您应该在第二个div中添加另一个框,在其上初始化TinyMCE编辑器,从第一个中获取内容并将其添加到第二个中。

You could try this: https://jsfiddle.net/yomisimie/y6172pua/1/ 您可以尝试以下方法: https : //jsfiddle.net/yomisimie/y6172pua/1/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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