title: Creating a div element inside a div element in javascript
body: <p>I'm trying a very basic example of creating a <code>div</code> inside an already existing <code>div</code>.</p>
  
  <p>It doesn't seem to be working when I use:</p>
  
  <pre><code>document.getElementbyId('lc').appendChild(element)
  </code></pre>
  
  <p>but works fine when I do this:</p>
  
  <pre><code>document.body.appendChild(element)
  </code></pre>
  
  <p>Do I need to add <code>windows.onload</code> function? Though it doesn't work even then! </p>
  
  <p>HTML code:</p>
  
  <pre><code>&lt;body&gt;
      &lt;input id="filter" type="text" placeholder="Enter your filter text here.." onkeyup = "test()" /&gt;
  
      &lt;div id="lc"&gt;  
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>JS code:</p>
  
  <pre><code>function test()
  {
      var element = document.createElement("div");
      element.appendChild(document.createTextNode('The man who mistook his wife for a hat'));
      document.getElementbyId('lc').appendChild(element);
      //document.body.appendChild(element);
  }
  </code></pre>