erikvimz
erikvimz

Reputation: 5476

Remove all CKEditor instances

I have a form in which I have CKEditor replacing my <textarea>s (multiple). I want to remove all CKEditor instances from the page before submitting the form. How can I accomplish this?

I've looked at Remove CKEdit Instance but it didn't help me at all.

NOTE: All my CKEditors have a class "ckedit"

Upvotes: 19

Views: 34505

Answers (3)

AlfonsoML
AlfonsoML

Reputation: 12690

This will destroy all CKEDITOR instances on a page:

for(name in CKEDITOR.instances)
{
    CKEDITOR.instances[name].destroy(true);
}

Upvotes: 59

anonymousdude
anonymousdude

Reputation: 1

Have you tried just...

delete CKEDITOR;

I had a similar situation and this worked for me. Just make sure you re-create it the next time you need to use it. Otherwise try keeping an array of id's of all the instances you create and just loop through that array and destroy them all.

Upvotes: -15

Piyush Sardana
Piyush Sardana

Reputation: 1758

you can make use of .remove() of jquery, before submitting.

Upvotes: 0

Related Questions