title: get element by second child ID
body: <p>I want to change the second ID "myDIV" second p tag(index 4) class "child" backgropund color. But my script does not work. How to get the second child ID?</p>
  
  <pre><code>&lt;div id="myDIV"&gt;
    &lt;p class="child"&gt;First p element with class="child" in a div (index 0).&lt;/p&gt;
    &lt;p class="child"&gt;Second p element with class="child" in a div (index 1).&lt;/p&gt;
    &lt;p class="child"&gt;Third p element with class="child" in a div (index 2).&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;div id="myDIV"&gt;
    &lt;p class="child"&gt;First p element with class="child" in a div (index 3).&lt;/p&gt;
    &lt;p class="child"&gt;Second p element with class="child" in a div (index 4).&lt;/p&gt;
    &lt;p class="child"&gt;Third p element with class="child" in a div (index 5).&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;button onclick="myFunction()"&gt;Try it&lt;/button&gt;
  
  &lt;script&gt;
  function myFunction() {
      var x = document.getElementById("myDIV")[1];
      x.getElementsByClassName("child")[2].style.backgroundColor = "red";
  }
  &lt;/script&gt;
  </code></pre>