Tuesday, July 10, 2012

Resolving ~ uncaught exception: [CKEDITOR.editor] The instance "myCKEditor" already exists.

Having added the CKEditor successfully to our web application, we see that it loads fine but during post-back we get a javascript error message as

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

The error states about the existence of the CKEditor in the browser. So, we have to get rid of the ones that already exists using the following method:

<script language="javascript" type="text/javascript">
    if (CKEDITOR.instances['myCKEditor']) { delete CKEDITOR.instances['myCKEditor'] };
    if (CKEDITOR.instances['myCKEditor']) { CKEDITOR.instances['myCKEditor'].destroy(); }

The above code will remove the existence of the ‘myCKEditor’ editor from the browser memory and recreates it thereby resolving the issue.

Happy Programming!!!


Gábor Gyimesi said...


I'm fighting with the same problem, and i'm stucked. In which part of the code did you put this fragment?
I tried it serveral ways but didn't worked.

Any help would be good.


Hemant said...

Hi Gabor,

Just add the above script fragment at the bottom of your page where you are using the CKEditor control. I know you might have changed the CKEditor instance name 'myCKEditor' in the above script matching with yours but just curious and wanted you double check just to make sure you have done that.


Anonymous said...

Works great! thanks!!!


Hemant said...

Glad to help you.

Thanks & Regards,

Anonymous said...

i love you man <3