title: Javascript get ID of a child element using information about the parent
body: <p>I have a div created using javascript. </p>
  
  <p>The div has a varying number of child elements that are all check boxes.</p>
  
  <p>I want to retrieve the id's of all the checkboxes using a loop.</p>
  
  <p>The div has been passed through into the class I am using, and has been called:</p>
  
  <pre><code>oInput
  </code></pre>
  
  <p>I know this is working fine as I am able to retrieve the number of child elements that the div has, using the following line:</p>
  
  <pre><code>oInput.childNodes.length
  </code></pre>
  
  <p>But my problem is I do not know how to retrieve the id of the child elements. All I want to do is to get the id's to display in an alert box for now.</p>
  
  <p>So far I have:</p>
  
  <pre><code>for (var ii = 0; ii &lt; oInput.childNodes.length; ii++)
          {
              var childId = oInput.childNodes[ii].id;
              alert("Child " + childId);
          }
  </code></pre>
  
  <p>But this is not the correct solution. I have searched around but there does not seem to be a clear answer to this question anywhere. I am only looking for a solution using javascript that will display the answer in the alert box in the loop.</p>