tags:

views:

446

answers:

4

I have a problem with loading CKEDITOR. I have made everything like described here: http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Integration But anyway i'm getting an error (Google Chrome 4.x) Uncaught [CKEDITOR.editor] The instance "html" already exists. Here is my code:

<script type="text/javascript" src="/engine/jq.js"></script> 
<script type="text/javascript" src="/engine/cke/ckeditor.js"></script> 
<script type="text/javascript" src="/engine/cke/adapters/jquery.js"></script>

<textarea class="jquery_ckeditor" name="html" id="html" rows="10">text</textarea>
<script type="text/javascript">
    if (CKEDITOR.instances['html']) { CKEDITOR.remove(CKEDITOR.instances['html']); // with or without this line of code - rise an error }
    CKEDITOR.replace('html');
</script>
A: 

Same error, getting it with the jQuery adapter though. Check the class of the textarea. As far as i can tell all text areas with class 'ckeditor' are automatically converted to editors. So either don't bother setting it with javascript or change the class.

Olly Hicks
+1  A: 

check this: if (CKEDITOR.instances['html']) { delete CKEDITOR.instances['html'] }; CKEDITOR.replace('html');

Mezi
A: 

Your page has a html container, try renaming your textarea ?

<textarea class="jquery_ckeditor" name="editor" id="editor" rows="10">text</textarea>
<script type="text/javascript">
    CKEDITOR.replace('editor');
</script>
Nealv
A: 

remove class='ckeditor' as it's triggering the automatic replacement system.

Pierre