Note that there are some explanatory texts on larger screens.

plurals
  1. POgetElementsByClassName doesn't work properly at Element nodes
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/7615162/getelementsbyclassname-returns-instead-of-asynchronous-appended-node">getElementsByClassName returns [] instead of asynchronous appended node</a> </p> </blockquote> <p>I face the following problem:</p> <p></p> <pre><code>&lt;div class="testA" id="test1"&gt; &lt;div class="colorSelector" id="0-0"&gt; &lt;div class="gbSelector" id="1-0"&gt; &lt;table style="none" id="2-0"&gt;&lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p></p> <p>The above written Tree is predefined. I now load a node tree via <strong><em>XMLHttpRequest</em></strong> &amp; Co. that I append into the <code>&lt;div class="testA" id="test1"&gt;</code> When I now try to get the Element <code>&lt;div class="colorSelector" id="0-0"&gt;</code> using <strong><em>getElementById("0-0")</em></strong> I get the expected result. But using <strong><em>getElementsByClassName("colorSelector")</em></strong> returns <strong><em>[]</em></strong>.</p> <p>Did I miss something? Is it probably a leftover of the fact the nodes were of type <strong><em>Element</em></strong> and not <strong><em>HTMLElement</em></strong>?</p> <p>I don't get it.</p> <p>EDIT: I used the comments to visualize that the nodes are added later when processing the response</p> <p>EDIT 2: <a href="http://lls-test.de/JS-Library/index.php" rel="nofollow noreferrer">http://lls-test.de/JS-Library/index.php</a> is what I receive as a response and handle in a script to append the first DIV inside the response tag</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload