I have 1 or more items in an array, for this example let's say they are [65, 66, 67]
how can (if it's even possible) do only a single if conditional to check for a match.
For example:
var keyArray = [65, 66, 67];
if(e.keyCode == any item in keyArray){
//Then do this
}
Try to make a jQuery plugin that a user can map multiple keys to a single action. E.g. pressing a, b, or c could alert "You're pressing either a, b, or c";
Here is my real sample code that isn't working:
$this.keydown(function(e){
if(e.keyCode in keySplit){
if(typeof callback == 'function'){
callback();
e.preventDefault();
}
}
});