Get Formatted Html From Ckeditor
Solution 1:
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.
Solution 2:
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>");
Solution 3:
To get htmlData from editor you should use the code snippet bellow:
var htmldata = CKEDITOR.instances.Editor.document.getBody().getHtml();
If this solution won't work, check if you have BBCode
plugins uninstalled.
Solution 4:
Please update ckeditor config.js with the following line
config.fullPage = true;
This will return the full html when you request getData();
Solution 5:
This worked for me:
CKEDITOR.instances["id"].getData()
Post a Comment for "Get Formatted Html From Ckeditor"