问题描述:

I'm using Boostrap (2.3.1) Modal to show forms (those are loaded with ajax). However, when i try to replace a textarea triggered by the "shown" event and CKEDITOR.replace(id) (CKEditor 4.2), it won't be replaced in IE 9 (Firefox & Chrome are fine).

If I set a timeout, it at least replaces the second time you call the dialog:

 $("#bok-modal-form").on("shown", function() {

$(this).find(".modal-body").find(".bokCKE").each( function() {

var id = $(this).attr("id");

if( CKEDITOR.instances[id] ) CKEDITOR.instances[id].destroy(true);

window.setTimeout(function() {

CKEDITOR.replace(id);

}, 1000);

});

});

Otherwise only the second time ie debugger shows the error that "document" is not set, pointing me to the following ( @ a.editable(new j(a,e.$.contentWindow.document.body)); ).

Not quite sure what I am doing wrong here?


CKEDITOR not replacing on the first time seems to be an issue with the shown event. In ie the modal-body is still empty. I surrounded the each loop with a setTimeout (300), and it seems to work (bit more testing required).


Update: that did the trick.

相关阅读:
Top