从CKEditor获取格式化的HTML [英] Get formatted HTML from CKEditor
问题描述
我在我的网络应用程序中使用CKEditor,对于如何使用HTML格式化来获取编辑器的内容我感到很失望。
I'm using CKEditor in my web app, and I'm at a loss as to how to get the contents of the editor with HTML formatting.
var objEditor = CKEDITOR.instances["sectionTextArea"];
var q = objEditor.getData();
这将得到我在CKEditor中输入的文本,没有任何标记。
This will get me the text entered in CKEditor, without any markup.
但是,
var q = objEditor.getHTML();
将返回空值。我做错了什么?
will return a null value. What am I doing wrong?
推荐答案
getHTML不是CKEditor对象的一个方法, JavaScript错误。
getHTML isn't a method of a CKEditor object, so instead of null you should have a javascript error.
api定义的方法是 getData()如果这不工作,那么你的代码中有一些其他问题,尝试使用警报来验证此刻的内容。
The method defined by the api is getData() if that doesn't work then you have some other problem in your code, try to use an alert to verify the contents at that moment.
这篇关于从CKEditor获取格式化的HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!