How to destroy an instance of ckeditor 4

Dung Do Tien Apr 01 2020 1416

Hi There,

I have an application to make a comment box look like Facebook comments. This box has many forms to post the comment. I use CKEditor 4 to input, but all editor is generated dynamically by the comment of users.

Every form has a button to remove the form, so how can I destroy CKEditor of that form when it's removed? I used the below command but it not working.


Please tell me if you know any ideal.

Have 1 answer(s) found.
  • D

    Dung Do Tien Apr 02 2020

    CKEditor has provider destroy() function to remove an instance of it. Have some ways to remove one or more Ckeditor as bellow:

    1. Remove one by one with instance name (by id)

    if (CKEDITOR.instances["editorId"]) { // Check null


    if (CKEDITOR.instances.editorId){

    2. Remove all instance have in the page

    for(var name in CKEDITOR.instances)

    In your case, you should generate dynamic id for each CKEditor and when click button Remove and find to CKEditor in that form and get the id of it and remove.

    I hope that useful to you

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close