Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7071973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:45:07+00:00 2026-05-28T05:45:07+00:00

Reading through the CKEditor documentation , I see that they have an option to

  • 0

Reading through the CKEditor documentation, I see that they have an option to destroy an instance with CKEDITOR.instances.instanceName.destroy();. However, if the DOM has changed, and the whole WYSIWYG DOM structure has been removed, I get the following error in Chrome:

Uncaught TypeError: Cannot read property 'document' of null

…and the following one in Firefox:

i.contentWindow is null

Is there any way to work around this?

Due to the way my app is structured (loading content via AJAX), I cannot call .destroy() when the elements are still on the page.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:45:08+00:00Added an answer on May 28, 2026 at 5:45 am

    If you need to destroy the ckeditor object and the elemnets in the DOM AFTER an AJAX call, you can do it by setting a boolean parameter to the function call destroy(true). This way it wont try to update the DOM:

    var editor = CKEDITOR.instances[name];
    if (editor) { editor.destroy(true); }
    CKEDITOR.replace(name);
    

    I have wrote 2 functions to be able to control these things a bit better. Notice that I have declared a variable before these functions can be used, but there are much slicker ways, but this approach was good enough for the purpose I needed it(I use and need only one instance):

        if(typeof(editor) == 'undefined')
            var editor=null;
    
        function ck_delete(editor)
        {
            if(typeof(editor) != 'undefined' && editor!=null)
                editor.destroy();
        }
    
        function ck_init(ck_inst_name)
        {
            var el_id=document.getElementById(ck_inst_name);
            if(typeof(el_id) != 'undefined' && el_id!=null)
            {
                if(typeof(editor) == 'undefined' || editor==null)
                {
                    editor=CKEDITOR.replace( ck_inst_name );
                }
                else
                {
                    ck_delete(editor);
                    editor=null;
                    editor = CKEDITOR.replace( ck_inst_name );
                }
            }
        }
    

    I also check if a HTML element that should be replaced exists so I dont get an error message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading through the Zend Framework coding standards , where they state that curly
I an reading through some examples of normalization, however I have come across one
Reading through the following instruction table manual I see that integer multiplication is often
Reading through the Flickr API documentation it keeps stating I require an API key
Reading through some of the questions here, the general concensus seems to be that
Reading through the SendAsync , BeginAsync method illustrations of Socket s, I realized that
Reading through documentation, I found following: 1.9.1 1.8.4 1.8.2 A version of 1.8.2 select
I have been reading through the C++ FAQ and was curious about the friend
Reading through the documentation for powershells add-type it seems you can add JScript code
I'm reading through Apple's documentation on CA, and I was trying to do a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.