title: Javascript - building a list of all LI with a given ID and click every one
body: <p>I have a list that is built like this: </p>
  
  <pre><code>&lt;ul id="ajaxList" class="ajaxListUL"&gt; 
  </code></pre>
  
  <p>and then, every element of the list is like this </p>
  
  <pre><code>&lt;li class="ajaxListLI" id="ajaxListRow_32412312"&gt; 
  </code></pre>
  
  <p>this number 32412312 is random. Every element of the list has one 
  number there, like </p>
  
  <pre><code>&lt;li class="ajaxListLI" id="ajaxListRow_32443232"&gt; ...
  &lt;li class="ajaxListLI" id="ajaxListRow_86752312"&gt; ...
  &lt;li class="ajaxListLI" id="ajaxListRow_35644312"&gt; ...
  </code></pre>
  
  <p>etc. </p>
  
  <p>every LI is clickable, and I need to make a loop to click every one. </p>
  
  <p>but the list has also elements like this</p>
  
  <pre><code>&lt;li class="ajaxListXT"&gt; ...
  </code></pre>
  
  <p>that are not clickable.</p>
  
  <p>What I need to do is to build an array of all LI elements on the page that IDs start by "ajaxListRow_" and click them.</p>
  
  <p>I did this so far:</p>
  
  <pre><code>var children = document.getElementById('ajaxList').childNodes;
  var length = children.length;
    var elements = [];
    var child;
    for (i = 0;  i &lt; length; i++) {
      child = children[i];
      if (child.id.substring(0, 12) == "ajaxListRow_")
        elements.push(child);
        document.child.click();
    }
  </code></pre>
  
  <p>it stops on the IF line, complaining about the id stuff.
  I have tried to remove the id, without success.</p>
  
  <p>At this point I don't even know if these lines are correct:</p>
  
  <pre><code> elements.push(child);
    document.child.click();
  </code></pre>
  
  <p>for adding a LI to the array and to click that li.</p>
  
  <p>How do I do that? 
  thanks. </p>