title: Keypress in text input preventing typing
body: <p>I have a text input that I want to execute a function when enter is pressed. I used if condition to determine if enter is pressed but this causes the user not to be able to type in the input box. What can I put in the else condition to allow them to type normally? </p>
  
  <p><a href="https://jsfiddle.net/sbnLupc4/" rel="nofollow">JsFiddle</a></p>
  
  <pre><code>function addItem(e) {   
      e.preventDefault();                         // Prevent form being submitted
      var text = $('input:text').val();           // Get value of text input
      var itemArr = text.split(',');                                                              
      var lngth = itemArr.length                  
  
      for(i = 0; i &lt; lngth; i++)                  
      {
          $list.append('&lt;li&gt;' + itemArr[i] + '&lt;/li&gt;');    // Add item to end of the list
          updateCount();                                  // Update the count
      } // End loop
  
      $('#addItems').val('');                         // Empty the text input
      return false;
  }
  
  $('#addItems').keypress(function(e) {
      if(e.which == 13) {
          addItem();
      }
      return false;
  });
  </code></pre>