Below code work only for latin n, but how to make it work for cyrillic н
if(event.keyCode === 78) {
console.log('okay');
}
And is weird that this code works if i change the keyboard layout different from US and click on latin N
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not quite sure what you’re asking, but I’m going to assume you want to get the character associated with typing in a cyrillic character on a keyboard. If so, I imagine you’re using the wrong event (
keydownorkeyup) when the correct event iskeypress.keydownandkeyuptell you about the physical key pressed whilekeypresstells you about the character that was typed. Here’s a simple cross-browser example of how to get the typed character:Here’s the definitive reference for JavaScript keyboard events: http://unixpapa.com/js/key.html