jquery .keyup .keypress do not fire, but the function is called on page reload
<p>Any reason why the following code would not fire on keypress but would on page reload?</p>

<pre><code>$(document).ready(function(){

$('#weight').keypress(valNum("weight", "weight"));    

function valNum(number, clas){
    var name = $("#"+number).val();
    var reg = /^([0-9\-\ \.]{2,6})$/;
    if(!reg.test(name)){
    $("."+clas+" .nogood").show();
    $("."+clas+" .good").hide();
    }else{
    $("."+clas+" .good").show();
    $("."+clas+" .nogood").hide();
    }
}
})
</code></pre>
