Hi, I'm trying to filter keyboard input in a form field:
I'm using this piece of code:
function solonumeri(event) {
alert(event.keyCode);
if(event.keyCode > 47 && event.keyCode < 57) {
alert(SOLO_NUMERI);
return false;
} else {
return true;
}
}
$().ready(function () {
$('.only_number').bind('keyup', function(e) { return solonumeri(e) });
});
If i bind this function on the keyup or keydown event the first alert
returns the right keycode, but if I change the event to keypress then it
returns 0.
Any help?
Thank you
--
gianiaz.net - Giovanni Battista Lenoci
P.le Bertacchi 66
23100 Sondrio (SO) - Italy