Wednesday, January 16, 2013

CKEDITOR instances and operations by jQuery

 var id = "CKEDITOR_100";

/* Get CKEDITOR */
var editor = CKEDITOR.instances[id];

/* Set data to CKEDITOR */
editor.setData("The Content");

/* Update CKEDITOR content */
try {
    for (var i in CKEDITOR.instances) {
        if (CKEDITOR.instances[i]) {
            CKEDITOR.instances[i].updateElement();
        }
    }
} catch (ex) {

}

/* Destroy CKEDITOR */
editor.destroy();

jsFiddle example of CKEDITOR instance update content

No comments:

Post a Comment