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_first').keyup(function(event){
if(isNaN(String.fromCharCode(event.which))){
var value = $(this).val();
$(this).val(value.substr(0,value.length-1));
}
});
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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…