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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:44:39+00:00 2026-06-12T04:44:39+00:00

I can see a DOM element with an ID of Foo by using the

  • 0

I can see a DOM element with an ID of Foo by using the debug inspector.

This DOM element is inserted dynamically by a script that I do not have access to.

Because of this you can not see it when you do View->Source.

When I try to access the element using

document.getElementById('Foo'), it returns a null b.c. it can not find it.

Verified this in the debug console as well.

Is it possible to get elements that are inserted dynamically?

I ask b.c. I would like to remove the node.

  • 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-06-12T04:44:40+00:00Added an answer on June 12, 2026 at 4:44 am

    Yes, you can:

    function addElement() {
        var foo = document.createElement('p');
        foo.id = "bar";
        document.body.appendChild(foo);
    }
    function getElement() {
        alert(document.getElementById('bar'));
    }    
    
    addElement();
    getElement();
    

    See also a live demo of this.

    Why your example doesn’t work is hard to say as you haven’t provided any details.

    At a guess, the element you are seeing is in a different document, embedded in an iframe, in which case you would have to access the document in the iframe before calling getElementById on it. This is, of course, subject to the same origin policy.
    ​

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

Sidebar

Related Questions

I have this iframe and as u can see it call a js function
I have an IE bug that I'm not sure how to fix. Using jQuery
I added a DOM element (a link) with jQuery. I can see the element
I can see that this question has been asked several times, but none of
First of all, I have to use and create this DOM element in a
I have a container td element that I populate successfuly with other elements using
I've cached a DOM element in jquery and wondered how i can see if
I can see that GD library is for images. But I can't see differences
I can see some potential difficulties with this concept but the idea is: I
I can see that Collections.unmodifiableSet returns an unmodifiable view of the given set but

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.