title: Append Array Values To List Items
body: <p>I'm trying to output an array of items to a list. The problems is when I click submit it's adding all the array items to each list item instead of one each time.</p>
  
  <p>JSFIDDLE:
  <a href="https://jsfiddle.net/b7Lwbrof/" rel="nofollow noreferrer">https://jsfiddle.net/b7Lwbrof/</a></p>
  
  <p>Thanks!</p>
  
  <pre><code>var itemList = [];
  var container = document.getElementById('container');
  
  // On click
  document.getElementById('submit').addEventListener("click", function(){
      var itemValue = document.getElementById('itemValue').value;
  
      // Push to array
      itemList.push(itemValue);
  
      // Append to List
      for(i=0; i&lt;itemList.length; i++) {
          var items = document.createElement("li");
          document.getElementById('container').appendChild(items);
          items.innerHTML = itemList[i];
      }
  })
  </code></pre>