动态添加tinymce到新的textarea
我该怎么做
function addTinyText(id, text){
//add textarea to DOM
$('<textarea id="txt'+id+'"></textarea>').append(text).appendTo('body');
//init tineMCE
tinyMCE.init({
theme : "advanced",
plugins : "emotions,spellchecker"
});
//add tinymce to this
tinyMCE.execCommand("mceAddControl", false, 'txt'+id);
}
,但结果每次我们有一个新的 textarea+tinyMCE 但里面没有文本
我错了什么?
How can i do this
function addTinyText(id, text){
//add textarea to DOM
$('<textarea id="txt'+id+'"></textarea>').append(text).appendTo('body');
//init tineMCE
tinyMCE.init({
theme : "advanced",
plugins : "emotions,spellchecker"
});
//add tinymce to this
tinyMCE.execCommand("mceAddControl", false, 'txt'+id);
}
but as a result every time we have a new textarea+tinyMCE but no text inside
What do i wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我搜索了很长时间才找到类似问题的答案。
即使我可以让编辑出现,我的内容也没有被发布。
我让它像这样工作:
我使用标准 jquery 代码将类名为 wysiwyg 的所有文本区域启动为tinymce 对象。
ajax 调用完成并加载新的文本区域后,我运行此函数:
现在我的代码终于正确发布了。
I searched a very long time to find an answer to a similar problem.
My content was not being posted even thou I could get the editor to appear.
I got it working like this:
I used the standard jquery code to initiate all text areas with class name wysiwyg as tinymce objects.
After ajax call completes and new textarea is loaded I run this function:
Now my code is finally being posted correctly.
线
应该是线
line
should be line