title: How to get the keypress value from an event object in jQuery
body: <p>I want to disable users from entering a character into a HTML text input field that isnt a letter or number.</p>
  
  <p>This exact functionality can be seen on the Twitter signup page (username field) <a href="https://twitter.com/signup" rel="nofollow noreferrer">https://twitter.com/signup</a>.</p>
  
  <p>Im trying to write this in jQuery. But i need to be able to grab the incomming keypress event value to test which key was pressed and if its value is acceptable.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>&lt;input type="text" id="username" name="username" /&gt;
  
  &lt;script type="text/javascript"&gt;
  $("#username").keypress(function(event){   
  
   // Get the keypress value
   // ...?
  
  // If the keypress value is illegal then disable it
  if (...){
     event.preventDefault();
  }
  
  });
  &lt;/script&gt;
  </code></pre>