title: jquery keypress() events are not working for keyup()
body: <p>Here is the code for keypress function, which is allowing only numbers
  <a href="http://jsfiddle.net/lesson8/HkEuf/1/" rel="nofollow">http://jsfiddle.net/lesson8/HkEuf/1/</a></p>
  
  <p>But, for the same keycodes, keyup function is not working. I mean, if I use</p>
  
  <pre><code>$(document).ready(function () {
    //called when key is pressed in textbox
    $("#quantity").keyup(function (e) {
       //if the letter is not digit then display error and don't type anything
       if (e.which != 8 &amp;&amp; e.which != 0 &amp;&amp; (e.which &lt; 48 || e.which &gt; 57)) {
          //display error message
          $("#errmsg").html("Digits Only").show().fadeOut("slow");
                 return false;
      }
     });
  });
  </code></pre>
  
  <p>The reason for using keyup is to get the current entered value in the textbox. If I use <code>keyup</code> function, I will get the current value. But, If I use keydown or keypress, I am getting the previous or existing value in the textbox
  see the updated code with different functions
  <a href="http://jsfiddle.net/dgireeshraju/HkEuf/7300/" rel="nofollow">http://jsfiddle.net/dgireeshraju/HkEuf/7300/</a>
  this is the example with keydown, which is giving the existing value.</p>