Skip to content Skip to sidebar Skip to footer

Keycode Detection On Azerty Vs. Qwerty

How can I in JavaScript detect the typing of a question mark on AZERTY keyboard ? On QWERTY keyboard a question mark produces the code 191, but on AZERTY it seems to produce code 1

Solution 1:

The fastest solution I can think of is to compare the key with the actual question mark, so something like this would be a good solution.

document.addEventListener('keydown', function(event) {
    if (event.key && event.key === '?') {
        // your code goes here
    }
}, true);

Post a Comment for "Keycode Detection On Azerty Vs. Qwerty"