views:

355

answers:

4

Hello,

I don't seem to be able to capture two events at the same time. I am trying to capture the Shift and Click (mouse click) event.

I have no problem capturing each action separately but not the two together.

Has anybody done some research on that particular problem.

Cheers

nawak

+1  A: 

jQuery Keys

This seems to help

rahul
A: 

If I understand your question correctly, you can use the shiftKey property of the event object that you receive in your click handler to check whether the shift key was down when the user clicked.

EDUT: shiftKey, not shift

SLaks
+4  A: 

Yes:

$(document).click(function(e) {
    if (e.shiftKey) {
        alert("shift+click")
    } 
});
Chris Pebble
+1  A: 

You can check the event.shiftKey boolean property.

$(selector).click(function(event) {
    if (event.shiftKey) {
        //....
    } 
});
CMS