问题
I have 3 tinymce textarea, in my page. And I want to populate these text areas from ajax.
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"
.
.
.
.
回答1:
Try this
for(i=0; i < tinymce.editors.length; i++){
tinymce.editors[i].setContent(value);
}
Edit: You may also use the following
for(i=0; i < tinymce.editors.length; i++){
tinymce.get(tinymce.editors[i].id).setContent(value);
}
回答2:
if you are using the tinyMCE jquery editor you can try the following code
$.each(tinyMCE.editors, function(index, editor){
editor.setContent(value);
);
来源:https://stackoverflow.com/questions/5553716/setting-content-into-multiple-tinymce-textarea