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 6757191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:37:00+00:00 2026-05-26T13:37:00+00:00

I have a need to remove an element from my screen and then regenerate

  • 0

I have a need to remove an element from my screen and then regenerate an element with the same name.

In the code there is a deleteObject function and a appendChild call.

In the deleteObject function it is removing the element(s) by using the removeChild statement (as seen below).

See this jsfiddle for what I’m trying to accomplish. Right now the fiddle works but my code still does not. I think it has to do with the “top” keyword. See this question for my thoughts on that.

Like I said earlier I have an element called “container1” that needs to be removed and then I have a new “container1” that needs to be created. When I remove the code out of the deleteObject function my new “container1” displays, however, when I include the code it appears to conflict and the new “container1” never gets displayed.

I’m wondering is there some sort of javascript caching that is going on? As the remove and create functions are called back to back. Is there a way that I can use the code that I have but add some sort of delay?

Any advice appreciated!

    function deleteObject(id) {
        try {
            var obj = document.getElementById(id);
            obj.parentNode.removeChild(obj);
        } catch (e) {}
        //do something
    }

function hidePopWin() {
    if (gPopupMask == null) {
        return;
    }

    deleteObject('popupMask_' + popuplayer);
    deleteObject('popcont_' + popuplayer);

    popuplayer--;

    if (popuplayer == 0) {
        gPopupIsShown = false;
        gPopupContainer = this.undefined;
        gPopupIframe = this.undefined;
    } else {
        var showmask = document.getElementById('popupMask_' + popuplayer);
        if (showmask) {
            showmask.style.display = "block";
            gPopupContainer = document.getElementById("popcont_" + popuplayer);
            gPopupIframe = document.getElementById("iframe_layer" + popuplayer);
        }
    }
    //console.log("got here: " )
}

UPDATE:
This jsfiddle is more accurately displaying what is going on(however, in the fiddle it works, but internally it doesn’t): See this question for further information

  • 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-26T13:37:01+00:00Added an answer on May 26, 2026 at 1:37 pm

    Even though trivial, perhaps you might have overlooked the DOM actually loading?
    jsFiddle calls your code on onLoad.

    If you call deleteObject('id');, it won’t work until the after document/element has been loaded into the DOM, because the ID doesn’t exist until then.

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

Sidebar

Related Questions

I have a problem where I need to remove all code and triggers from
I have two different list types. I need to remove the elements from list1
I have a ParameterInfo array. I need to remove certain values from the array.
I have a vector of pointers to objects. I need to remove an element
I have an Ember.Button which should remove an element from an array. The button
I need to remove an element from a list which contain inner lists inside.
I have an array of elements in Ruby [2,4,6,3,8] I need to remove elements
I have a large list [[1,.., ..],[2,...,...],[5,...,...],[1,...,...]] I need to remove all elements that
I have an array Items which has 10 elements. I need to remove the
I have a text column varchar(4000) with text: 'aaabbaaacbaaaccc' and I need to remove

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.