I have an event listener in Javascript, I can tell whether a key event is Ctrl (e.keyCode == 17), but how can I know this Ctrl comes from the right one or left
(e.keyCode == 17)
There is event.location property for left ctrl key it will be 1 for right one 2, you can check browser support on canIuse
event.location
if (e.which == 17) { if (event.location == 1) { // left ctrl key } else if (event.location == 2) { // right ctrl key } }