title: How do I add items to a list? using only onsubmit <form>
body: <p>I am creating a to do list using Javascript/HTML. How do I add text input to a list using onsubmit in a <code>&lt;form&gt;</code>. This is what I got so far.</p>
  
  <pre><code>&lt;h1&gt;To-Do List&lt;/h1&gt;
  
  &lt;form onsubmit= "return addItem(document.getElementById(list), inputText)"&gt; ` 
      &lt;input type="text" id="inputItem" placeholder="Enter a Task"&gt;
      &lt;input type="submit"&gt;
  
  &lt;/form&gt;
  
  &lt;ul id="list"&gt;
  
  &lt;/ul&gt;
  
  &lt;script 
  // adds Task to list
  
  function addItem(list, inputText) {
      var listItem = document.createElement("li");
      listItem.innerText = "inputText";
  
      list.appendChild(listItem)
  
  &lt;/script&gt;
  </code></pre>