Skip to content Skip to sidebar Skip to footer

Jquery Keypress 37 Issue, '%' And [ Left Arrow ] Not Work In Ie 10

Good morning, I facing a issue on the IE 10 where my keypress still can enter '%' but the FF and Chrome no such issue. I found out that the key 37 is the [ left arrow ] which match

Solution 1:

Use var key = event.which; instead and join the if-statements.

The event.which property normalizes event.keyCode and event.charCode. It is recommended to watch event.which for keyboard key input.

- https://api.jquery.com/event.which/

$('#refId').on("keydown", function(event) {
    // allow letters, numbers and keypad numbers ONLYvar key = event.which;
    if((key >= 48 && key <= 57) ||
        (key >= 65 && key <= 90) ||
        (key >= 97 && key <= 122) ||
        key == 8 || 
        key == 9 ||
        key == 37 ||
        key == 39 ||
        key == 46) {
        returntrue;
    }

    returnfalse; 
});

Post a Comment for "Jquery Keypress 37 Issue, '%' And [ Left Arrow ] Not Work In Ie 10"