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.
Yes, you can:
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
getElementByIdon it. This is, of course, subject to the same origin policy.