4

I have two CKeditor fields that are a part of the form. I have some action buttons on the page, so whenever I click either 'clear' or 'cancel' this function is fired along with other stuff:

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

That way I am cleaning the contents of the CKEditor fields. The problem is that if I click 'cancel', then go back to the page and click "clear", Internet Explorer gives an "innerHTML is null or undefined" JS error.

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

CKEditor initialization 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 cancel button to hide the form and show other stuff. There's no page reload.

2
  • Could you post some more code? And have you tried using the jquery extension and then doing $('#ed2').val(''); - docs.cksource.com/CKEditor_3.x/Developers_Guide/jQuery_Adapter Commented Oct 28, 2011 at 20:47
  • Using the jQuery adapter would mean just adding an extra layer and it won't help him to understand the problem Commented Oct 29, 2011 at 9:57

1 Answer 1

1

I found the solution to this problem. The reason it was doing that because my clear method was fired using jQuery bind function and wasn't placed in the onReady function, so it was binding the events together and giving this error. The solution to this was to use unbind first.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.