title: JavaScript enter key not passing input value
body: <p>I currently have a input field that calls a javascript updateCart() function. It uses the onblur() event and it works fine when user clicks outside of the field. The issue I'm having is that I also need it to work when the user presses on the "enter" key. So if they enter "23" and then press enter, the onblur will never happen.</p>
  
  <p>I'm trying to use the onkeydow event but I am having issues. The "var qte" in the enterKey() function is always blank. Anyone know what I'm doing wrong? Am I using the correct event? Is there a better way of doing this?</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>PS : I'm being forced to use JavaScript only. no jQuery unfortunately.</p>
  
  <pre><code>&lt;input type="text" name="qte_name" value="" size="3" onblur="updateCart('product1', this);"  onkeydown="enterKey(this, event, product1');" /&gt;
  
  function updateCart(id, quantityObj) {
    var quantity = quantityObj.value;
    // calls appropriate Ajax code. All is fine here
  } 
  
  function enterKey(obj, e, id) {
      var key = document.all ? window.event.keyCode : e.which;
      var qte = obj.value; // Keeps appearing as blank
  
  lastAction = key;                           
      if(key == 13) {         
         updateCart(id,obj);
         // I will forward to a new page here. Not an issue.
      }
  }
  </code></pre>