title: Pass a Value from Button to Text Field in JavaScript
body: <p>I'm trying to pass a number to a text field on button click. User hits "add to cart" and the 2499 is added to the total already in the text field. </p>
  
  <pre><code>&lt;form name="cart"&gt;
      &lt;input id="display" type="text" name="output" size="6" placeholder="0000"/&gt;
  &lt;button id="scart" value="Add to Cart" onclick="addCart()" +='2499'"/&gt;
  
  &lt;script type="text/javascript"&gt;
  
  var total=""
  
  function addCart(){
      document.getElementById('scart').value;
      total+= document.getElementById('display').value;
      console.log(total);
  }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>When learning, I feel that I understand the logic, but don't know the syntax.</p>