This is really weird.
I have a textarea.
I listen to the keyup and keypress events.
When I press “(“, keypress is fired with e.keyCode == e.which == 40
When I press the arrow down key, keyup is fired with e.keyCode == e.which == 40
Why is this so strange?
keydownandkeyupevents provide a code indicating which key is pressed, whilekeypressindicates which character was entered.Char code for “(” is 40 (
keypressevent) and key code for down arrow is also 40 (keyup).Try: