Since i'm pretty new to js and jquery i was wondering if it's possible to bind more than one key to an event. I tried ||
, ,
and or
without any luck.
I'd like to bind a
and left-arrow
in an single case instead of making another case.
$(document).keydown(function(event) {
switch(event.keyCode){
case (37 or 65):
alert("left");
break;
}
});
$(document).keydown(function(event) {
switch(event.keyCode){
case 37:
case 65:
alert("left");
break;
}
});
Fiddler: http://jsfiddle.net/Rn8kY/