views:

94

answers:

1

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?

A: 

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

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

AlfonsoML
Followed a bad snippet. Thanks for setting me straight.
Laramie

related questions