java
iphone
css
c
python
mysql
linux
xcode
android
ruby-on-rails
regex
visual-studio
eclipse
json
oracle
cocoa
tsql
asp
jsp
dom
what I do:
var instance = CKEDITOR.instances['test']; instance.destroy(); instance = null;
this is what i've done:
var CKeditors = {}; function loadEditors() { var $editors = $("textarea.ckeditor"); if ($editors.length) { $editors.each(function() { var editorID = $(this).attr("id"); if(CKeditors[editorID]){ CKeditors[editorID].destroy(); CKeditors[editorID] = null; } var dst = editorID+'-element'; var html = ''; if( $(this).val() ){ html = $(this).val(); } CKeditors[editorID] = CKEDITOR.appendTo(dst, {}, html); }); $("textarea.ckeditor").hide(); } } function updateCKEditors() { for(x in CKeditors){ $("#"+x).val(CKeditors[x].getData()); } }
then after ajax succes im doing
loadEditors()
and before form submitting (for example using ajax):
updateCKEditors()
you need jQuery to have that working. this is for zend_forms, but after few corrections should work in normal forms too. play with 'dst' to do that.
Bit of an old topic, but i had a similar problem.
I used activ's solution above, which worked out great! CKEDITOR.appendTo did't work out for me, but with the next slight modification to the loadEditors function it did:
CKEDITOR.appendTo
loadEditors
function loadEditors() { var $editors = $("textarea.ckeditor"); if ($editors.length) { $editors.each(function() { var editorID = $(this).attr("id"); if(CKeditors[editorID]){ CKeditors[editorID].destroy(); CKeditors[editorID] = null; } var dst = editorID+'-element'; CKeditors[editorID] = CKEDITOR.replace(dst, {}); }); } }