I am working with an external site that allows embedded javascript content (Qualtrics). Qualtrics dynamically loads some controllers. When I test accessing these controllers via the Chrome web panel, after they have fully loaded, I can see the loaded controllers in the Elements window which represents the current DOM. However, I cannot access these elements by id, either with jQuery or via document.getElementById.
One of the controllers has the id QID12~14~handle
. In the Elements DOM browser, I see the tag:
<div id="QID12~14~handle" class="handle selected" style="left: 122px;"></div>
When I view the page's source, I see they are dynamically loading and inserted into the page via a script tag:
<div class='QuestionBody BorderColor'>
<div class='horizontalbar ChoiceStructure RtlOverride'></div>
<div id='debug'></div>
<!-- This has to be called after the html it references. Thats why its down here -->
<script type='text/javascript'>
QModules.loadExternalModule('../WRQualtricsShared/JavaScript/CSBar/slider.51487.js', function () {
(function () {
CS_QID15 = new CSBar('0', '100', '10', 'QID15', '');
if (CS_QID15.loaded) {
CS_QID15.setDecimals(0);
if (CS_QID15.snapToGrid) {
CS_QID15.makeSlider('QID15~1');
CS_QID15.makeSlider('QID15~2');
CS_QID15.setStartPositions({"1": 0, "2": 0, "3": 0.64599483204134});
}
else {
CS_QID15.makeSlider('QID15~1');
CS_QID15.makeSlider('QID15~2');
CS_QID15.setStartPositions({"1": 0, "2": 0, "3": 0.64599483204134});
}
}
}).delay(); //if ie is waiting for something and this loads too fast it breaks. the defer fixes a very esoteric bug.
});
</script>
<div class='clear zero'></div>
</div>
The page is not using iFrames. If I see an id in the current DOM, why can't I access it by it's id as it currently exists in the DOM?
If I call jQuery(".handle")
, I see this element:
[
<div id="QID12~14~handle" class="handle selected" style="left: 122px;"></div>,
<div id="QID15~1~handle" class="handle selected" style="left: 0px;"></div>,
<div id="QID15~2~handle" class="handle selected" style="left: 0px;"></div>
]
What could prevent me from accessing these elements by id?