Using jQuery, I would like to capture a keyboard event that is:
- before the user lifts their finger from the key
- after the characters from the keyboard event have registered in the input box.
To clarify, view this example. When keypress
fires, the input
value has not been updated yet.
[Edit]
Apparently I wasn't clear as to what I need.
The function must be called before the user lifts their finger up from the key, but after the key's character is placed in the input box. So the following do not work:
- keydown: at the
keypress
event, the value in the text box has not been updated
- keypress: at the
keypress
event, the value in the text box has not been updated
- keyup: this is called when the user lifts their finger, which is too late.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…