CKEditor InnerHTML Error

I have two CKeditor fields that are part of the form. I have some action buttons on the page, so whenever I click "clear" or "cancel", this function runs along with other things:

CKEDITOR.instances['ed1'].updateElement(); CKEDITOR.instances['ed1'].setData(''); CKEDITOR.instances['ed2'].updateElement(); CKEDITOR.instances['ed2'].setData(''); 

Thus, I clear the contents of the CKEditor fields. The problem is that if I click cancel, return to the page and click clear, Internet Explorer will give the error "innerHTML null or undefined" JS.

It works fine in other browsers, and this only happens if I update twice in a row from different buttons. Is there a workaround for this?

Initializing CKEditor onReady:

  CKEDITOR.replace('ed1', { htmlEncodeOutput: true, width:"700",toolbar: 'Basic' }); CKEDITOR.replace('ed2', { htmlEncodeOutput: true, width:"700",toolbar: 'Basic' }); 

I probably should add that I use .show() and .hide() whenever I use the cancel button to hide the form and show other things. There is no page reload.

+4
source share
1 answer

I found a solution to this problem. The reason for this is because my clear method was launched using the jQuery bind function and was not put into the onReady function, so it linked events together and gave this error. The solution to this was to use unbind first.

+1
source

All Articles