I am using the keyup and keydown events to get user’s keystrokes. These events do just that: fire when the key is up or down.
However, I’d like to get a repeat event when a key stays pressed.
What event should I be using?
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.
Use the
keypressevent for this purpose. Example:The key events are fired in the following order:
keydown– Oncekeypress– Multiple timeskeyup– Once (preventDefault()cannot prevent default behaviour any more, at this point)