I have following code snippet:
var reg = /^[0-9]$/;
$('input[type="text"]').keypress(function(){
console.log(reg.test(parseInt($(this).val())));
});
When I press any key (digit or other) it always return false
. But I can't find out the problem.Please give me some solutions.