title: Get id of first input inside a div using javascript
body: <p>HTML</p>
  
  <pre><code> &lt;div id="div-1"&gt; 
  &lt;input id = "input1" &gt;
  &lt;/div&gt;
  &lt;p id="demo"&gt;&lt;/p&gt;
  </code></pre>
  
  <p>JAVASCRIPT</p>
  
  <pre><code>var list = document.getElementById("div-1").firstChild.id;
      document.getElementById("demo").innerHTML = list;
  </code></pre>
  
  <p>The output i get is </p>
  
  <pre><code>Undefined
  </code></pre>