Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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();

This will get me the text entered in CKEditor, without any markup.

However,

var q = objEditor.getHTML();

will return a null value. What am I doing wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
144 views
Welcome To Ask or Share your Answers For Others

1 Answer

getHTML isn't a method of a CKEditor object, so instead of null you should have a javascript error.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...