是否将内容设置为多个TinyMCE文本区域? [英] Setting content into multiple TinyMCE textarea?

查看:335
本文介绍了是否将内容设置为多个TinyMCE文本区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面上有3个tinymce文本区域.我想用ajax填充这些文本区域.

I have 3 tinymce textarea, in my page. And I want to populate these text areas from ajax.

我知道原始textarea字段的名称,但是

I know the name of the original textarea field, but

tinyMCE.activeEditor.setContent(value);

不起作用,因为我没有任何活动的编辑器.

does not work, since I dont have any active editor.

这是我的代码的基本示例

Here is a basic example of my code

.
.
.
function(data) {
$.each(data, function(key,value)) {
    $("#"+key).val(value); //"#"+key is the id of tinymce editors in my form
},
"json"
.
.
.
.

推荐答案

尝试一下

for(i=0; i < tinymce.editors.length; i++){
    tinymce.editors[i].setContent(value);
}

您也可以使用以下

for(i=0; i < tinymce.editors.length; i++){
    tinymce.get(tinymce.editors[i].id).setContent(value);
}

这篇关于是否将内容设置为多个TinyMCE文本区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆