Detect key cordova

Hello guys,

I have this code for detect which key is pressed and prevent it in case is ,:

el.addEventListener('keypress', (e) => {
   if (e.keyCode === 44) {
       e.preventDefault();
    }
});

The problem is in the app that does not activate, I also tried the keyup, but it does not give me the correct key.


For now I have solved it by using the input focusout event and filtering the character by the value, but it would be much better to have the solution to the problem.

if (app.device.cordova) {
    el.addEventListener('focusout', (e) => {
        e.target.value = e.target.value.replaceAll(',', ' ');
    });
}