title: Can't get child element with DOM
body: <p>My code looks like this:</p>
  <pre><code>function myFunction(result) {
      var json = JSON.parse(result)
      var jsonKeys = Object.keys(json)
      var items = document.getElementById(&quot;items&quot;);
      var adds = items.getElementById(&quot;add&quot;);
      clearA()
      var i;
      for (i = 0; i &lt; jsonKeys.length; i++) {
          var btn = document.createElement(&quot;BUTTON&quot;);
          console.log(jsonKeys[i]);
          btn.innerHTML = jsonKeys[i]
          btn.setAttribute(&quot;id&quot;, jsonKeys[i]);
          btn.onclick = function() { run(this.id); }
          items.appendChild(btn)
      }
       
      
  }
  </code></pre>
  <p>I can get items and use them but when I try to get the child element &quot;add&quot; I get <code>items.getElementById is not a function</code></p>
  <p>This is the html:</p>
  <pre><code>&lt;div id=&quot;items&quot;&gt;
      &lt;div id=&quot;add&quot;&gt;
          &lt;input type=&quot;submit&quot; value=&quot;add&quot; onclick=&quot;foo(add)&quot;&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>