Get formatted HTML from CKEditor
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.
just to know that the right method for this is getData()
didn't help me. I did not know how to use it on the CKEditor object. and CKEDITOR.getData()
doesn't work.
this is how getData()
is used on the CKEDITOR object:
CKEDITOR.instances.my_editor.getData()
...where my_editor
is the id of your textarea used for CKEditor.
The opposite of it is setData()
:
CKEDITOR.instances.my_editor.setData("<p>My Text</p>");