How to get keypress event for decimal in mobil app?


#1

Hello,

I am using meteor+blaze and need to all only integer value in number input field.
I tried to use keypress/keyup events for input type nuber but not able to get the event for decimal point, android mobile number keypad return same keycode 229 for .,- keys and when i return false for keycode 229, it’s not working. But events are working fine with number value keys on mobile.
code:

'keyup #weight': function (event, instance) {  
        event.preventDefault();
        if (event.keyCode < 48 || event.keyCode > 57) {
            console.log(this, "Integer values only");
            return false;  // stop processing
        }
    }

Please advice, how i can prevent user from enter a decimal value in input field.
Thanks.