title: jquery keyup function check if number
body: <p>i am trying to create an input field where the user can only type in numbers. this function is already working almost fine for me: </p>
  
  <pre><code>        $('#p_first').keyup(function(event){
          if(isNaN(String.fromCharCode(event.which))){
              var value = $(this).val();
  
              $(this).val(value.substr(0,value.length-1));
          }
      });
  </code></pre>
  
  <p>but the problem is, whe the user holds the key with an character the function keyup is not triggering.... any ideas how i can forbid this? </p>