2

What's the key code for left shift? When I press left shift do something..

Thanks

alex
  • 479,566
  • 201
  • 878
  • 984
test
  • 17,706
  • 64
  • 171
  • 244

3 Answers3

4

With JavaScript you can only detect Shift. You can't differentiate left and right shift. Using jQuery:

$("body").keypress(function(event) {
  if (event.shiftKey) {
    //do something here
  }
});
Máthé Endre-Botond
  • 4,826
  • 2
  • 29
  • 48
2

As you can see from this page, the browser does not differentiate from left and right shift. I don't think it's possible.

Chris Laplante
  • 29,338
  • 17
  • 103
  • 134
1

The only way to know is to ask the user.

So what that means is it not possible with code alone, and not desirable to ask the user.

There is probably a better solution to the problem you think you have.

alex
  • 479,566
  • 201
  • 878
  • 984