Question: I am trying to listen to the shift key being pressed and released again using jQuery.

See JSFiddle [here](http://jsfiddle.net/669QT/)

```
$(document).bind('keydown', function (event) {
    if (event.shiftKey) {
        document.body.innerHTML += 'shift down<br>';
    }
});
$(document).bind('keyup', function (event) {
    if (event.shiftKey) {
        document.body.innerHTML += 'shift up<br>';
    }
});

```

The keyup/keydown events seem to be called properly in general. However, if shift is the only button being pressed then `event.shiftKey` is only set for the keyDOWN event, not for the keyUP event. You can see that in the JSFiddle the "key up" message is never printed in this case. However, if I press shift + something else (e.g. Ctrl) everything works like it should.

Is this a bug in jQuery? Any workarounds?

Answer: 
Try [this](http://jsfiddle.net/669QT/2/)

```
$(document).bind('keydown', function (event) {
    if (event.keyCode == 16) {
        document.body.innerHTML += 'shift down<br>';
    }
});
$(document).bind('keyup', function (event) {
    if (event.keyCode == 16) {
        document.body.innerHTML += 'shift up<br>';
    }
});

```

checking the keycode works .. but event.shiftkey does not seems to work in keyup
As ardeneo mentioned in his comment I was misunderstanding the .shiftKey property. The correct way seems to be to listen to both keyup and keydown and then just check for event.shiftKey to see whether it was pressed or lifted.