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 following code does NOT work because keypress is only fired if a "real key" (not the shift key) is pressed. (I was hoping it would fire if just the shift key alone was pressed.)
var shifted = false;
$(function() {
$(document).keypress(function(e) {
shifted = e.shiftKey;
alert('shiftkey='+e.shiftkey);
});
$(document).keyup(function(e) {
shifted = false;
});
}
...
function myfunction() {
//shift is always false b/c keypress not fired above
}
shiftkey
instead ofshiftKey
:-) – Redpollshift+click
, usefilter-altered-clicks
– Semilunar