lee989's picture
Joined: 21/12/2010
Posts: 4
CKE Destroy & instance still exists
I created a function a while back to make clearing CKE easier. 99% of the time i only ever run 1 CK instance so i usually just destroy all instances. The problem is that i have CKE on a form in a popup jquery dialog box (probably quite common).

The function i wrote was

function destroyCKE(i) {
   if(i == undefined) {
      jQuery.each(CKEDITOR.instances, function(){
   else {
      if(eval("CKEDITOR.instances."+i) != undefined)


quite basic but it does the job... well it was doing the job. I've never noticed any issues with it before, but im running a local copy of a website while in development and it just doesnt seem to work. I have the dialog box clear CKE on close like so

$('<div></div>').attr('id', 'theDiag').dialog({
      modal: true,
      width: 700,
      close: function(){

                         destroyCKE();  //--- call to destroy all CKE instances   

      position: 'top',
      buttons:{   }

I console logged before and after the function executs and according to firebug it does clear the instance:

before (shows data in the instances object):
Object { timestamp="A7HG4HT", version="3.4", more...}

after (shows no data in the insatnces object):
Object {}

however when i open a new popup and cke trys to run i get

uncaught exception: [CKEDITOR.editor] The instance "content" already exists.

q is null
[Break On This Error] A.setStart(B.$,z.startOffset);A.setEnd... u=s&&s[1];if(t)q.attributes.width=t; 

Can anyone provide any info on this as im lost now.