I\'m trying to load and manipulate a hidden
tag in my overlay (part of my addon\'s functionality) in my Firefox Addon. But, I can\'t access an
Overlays always have to extend an existing element. If you have a tag at the top level of an overlay with an ID that doesn't yet exist in the document then this element is simply ignored ( tags being a noteworthy exception from the rule). This happens in your case, the ID
bContainer
doesn't exist in the document you are overlaying so your
tag is simply ignored. This mechanism allows for example having content for the Firefox and SeaMonkey Tools menu in the same overlay - this menu has a different ID in Firefox and SeaMonkey so the section overlaying the SeaMonkey menu is simply ignored in Firefox and vice versa.
If you want to add an element to the document then you need to overlay its root element. For the Firefox browser window it would look like this (note that main-window
is the ID of the root element):
...
A side-note: to access an element by its ID you need to use document.getElementById()
:
alert(document.getElementById("bContainer").src);