title: How to detect when the user presses Enter in an input field
body: <p>I only have 1 input field and I want to register onChange and onKeyPress event to detect when the users finish their input or press the Enter key. I need to use javascript only. Thanks for the help.</p>
  
  <p>I have:</p>
  
  <pre><code>var load = function (){
     //I want to trigger this function when user hit Enter key.
  }
  
  document.getElementById('co').onchange=load;   //works great
  document.getElementById('co').onKeyPress=load; 
  //not sure how to detect when user press Enter
  </code></pre>
  
  <p>html</p>
  
  <pre><code>//no form just a single input field
  &lt;input type='text' id='co'&gt;
  </code></pre>