I have an anchor tag that calls a JavaScript function.
With or without JQuery how do I determine if the shift key is down while the link is clicked?
The foll
The excellent JavaScript library KeyboardJS handles all types of key presses including the SHIFT key. It even allows specifying key combinations such as first pressing CTRL+x and then a.
KeyboardJS.on('shift', function() { ...handleDown... }, function() { ...handleUp... });
If you want a simple version, head to the answer by @tonycoupland):
var shiftHeld = false;
$('#control').on('mousedown', function (e) { shiftHeld = e.shiftKey });