get CKEditor data with Jquery – no plugin required

Tue, Apr 19, 2011

Javascript, Programming, Snippets

If you are using the CKeditor also with JQuery (not the ckeditor plugin) then at some point you might want to get the editor data without submitting the form.

after a lot of searching i managed to get the editor data without using the jquery plugin for CKEditor.

So if you are replacing text areas with the common way , e.g.

var bodyEditorEN = CKEDITOR.replace( 'bodyen', {toolbar : 'Basic'});

and this applies to the html element :

<textarea id="bodyen" cols="70" rows="10" name="bodyen"></textarea>

then all you need to do to access data with Jquery from the editor is by using the getData method from CKEditor:

var body = CKEDITOR.instances['bodyen'].getData();
alert(body);
Share
,

This post was written by:

- who has written 196 posts on ropox.net.

Software Engineer and Web Developer, keen on new technologies and has passion for web engineering.... Internet is my job and i love it...!!! Founded Baldpixel (baldpixel.com) on 2008 which is specialized on enginnering custom web projects while cooperating with top advertising agencies on the net.

Contact the author