sslepian sslepian - 5 months ago 56
HTML Question

Get formatted HTML from CKEditor

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.


var q = objEditor.getHTML();

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


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.