从CKEditor获取格式化的HTML [英] Get formatted HTML from CKEditor

查看:165
本文介绍了从CKEditor获取格式化的HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网络应用程序中使用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屋!

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