I use keydown event in jquery, but the problem it’s stateless for input language. It’s can’t determine the input is in English language or in Hebrew or Arabic…?
it returns only keycode, and I can’t get character.
Is there any solution??
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.
To determine the actual character, you should use the keypress event instead of
keydown. Whilekeydownprovides you with a key code,keypressindicates the character which was entered by the user.Another difference is that when the user presses and holds a key, a
keydownevent is triggered only once, but separatekeypressevents are triggered for each inserted character.Here’s an example of using the
keypressevent: