如何使用JQuery向CKEditor添加数据 [英] How to add data to CKEditor using JQuery
本文介绍了如何使用JQuery向CKEditor添加数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每次页面加载我需要加载文本到CK编辑器使用JQuery,为了从CK编辑器中获取数据我使用
Everytime a page loads I need to load text into the CK Editor using JQuery, in order to get data from CK Editor I use
var editor_data = CKEDITOR.instances['editor1'].getData();
现在有一个类似的功能,我可以用来把数据回编辑器?
now is there a similar function I could use to put the data back into the editor?
我使用ajax来设置这样的数据
I'm using ajax to set the data like this
$.ajax({
type: "POST",
url: "/inc/ajax/basic.php?menu_id="+menu_id+"&info=3",
success: function(msg){
CKEDITOR.instances['editor1'].setData(msg);
}
});
我做错了什么
推荐答案
试试这个:
CKEDITOR.instances['editor1'].setData(html)
其中'html'是包含要编辑的内容的字符串。
Where 'html' is a string containing content to edit.
这篇关于如何使用JQuery向CKEditor添加数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文