I have a text input, where I need to bind an event on doing a CTRL-V. I have set a global variable named ctrl
which is set to 1 whenever a keydown
is fired with a which
value of 17. Similarly it is made 0 when a keyup
is fired with which
value of 17
Problem is, there are two CTRL keys. So if I do something like: first pressing the left CTRL key, and while pressing it down, press the right CTRL key also (so that both CTRL keys are pressed now), and then I release only one of them, the keyup
is fired and the variable ctrl
is set to 0, even though the other CTRL key is still being pressed.
How do I fire the events such that the variable is set to 0 only when both CTRL keys are up (I don't need to exactly differentiate between them).