Mostafa Talebi
Mostafa Talebi

Reputation: 9183

CKEditor getting the content of the editor

I want to get the content of CKEditor with jQuery and then send it through AJAX....

but the $(..).val() or $(..).html() does not work and it seems I should use CKEditor object.

Any help on how to get the content?

Upvotes: 0

Views: 63

Answers (1)

Afzaal Ahmad Zeeshan
Afzaal Ahmad Zeeshan

Reputation: 15860

As far as I remember, CKEditor created an iframe and saved the content in it.

However, you can try the following method instead:

var content = $( 'textarea.editor' ).val();

Or, you can use a built-in function.

var editor = CKEDITOR.editor.replace('my-editor');

// Some Event, maybe Ajax
var val = editor.getData();

Here is the documentation for that: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#getData

Good luck!

Upvotes: 1

Related Questions