Laramie
Laramie

Reputation: 5587

Remove CKEdit Instance

I can't seem to destroy instances of CKEdit per the documentation.

Consider the following:

<input name="txt1" type="text" id="txt1" /><br />
<a href="javascript:void(0);" onclick="create()">Create</a><br />
<a href="javascript:void(0);" onclick="destroy()">Destroy</a>
<script type= "text/javascript" >
<!--
function create() {
    var hEd = CKEDITOR.instances['txt1'];
    if (hEd) {
        CKEDITOR.remove(hEd);
    }
    hEd = CKEDITOR.replace('txt1');
}
function destroy(){
    var hEd = CKEDITOR.instances['txt1'];
    if (hEd) {
        CKEDITOR.remove(hEd);
    }
}
-->
</script>

When destroy() runs, CKEDITOR.remove(hEd); is being called. Multiple clicks to create() produce multiple instances of CKEditor on screen, but their instances no longer appear in CKEDITOR.instances.

Am I missing something?

Upvotes: 22

Views: 46360

Answers (3)

Gene Phillip Artista
Gene Phillip Artista

Reputation: 21

Simple solution

CKEDITOR.instances['textareaId'].destory()

Upvotes: 1

chandra prakash
chandra prakash

Reputation: 1

You must use:

<textarea name="tx1" id="tx1" rows="15" cols="106"></textarea>

CKEDITOR.instances['tx1'] = false;

Upvotes: -1

AlfonsoML
AlfonsoML

Reputation: 12740

You must use hEd.destroy (editor.destroy()).

CKEDITOR.remove() is for internal use as stated in the API.

Upvotes: 41

Related Questions