Reputation: 131
I am using CkEditor to edit content and calling that page via ajax. It is working fine for first page load. But when I load another page, in console I see error that Instance is already exists. So tried to replace all textarea using CKEDITOR.replaceAll();
in everypage. But Again I get same error. When I searched for this error. I came accross other stackoverflow question With answer
if(editor.instance(Instancename) {
CKEDITOR.instances.textarea.destroy();
}
But I have multiple textarea,generated randomly so I can not use that code as I don't know id
or name
of textarea. Anyone have better suggesation what I should do to replace textarea to ckeditor?
Upvotes: 1
Views: 240
Reputation: 1061
When you are using CKEDITOR.replaceAll()
will create an instance but you are not reloading the page, so it will not destroy.
You have to distroy it manually.
But as you said you have multiple textarea generated randomly, you can use
CKEDITOR.replaceAll('className');
All you have to do is give classes to text-area (same class in onepage) and write this code right after you appending html
to div
.
And use /ckeditor/adapters/jquery.js
Upvotes: 1