I am trying to create an easy way for my users to select the trigger key that makes the code work altogether. I have this so far.
var triggers = {space:"32",enter:"13",tab:"9"};
var triggerKeys = ["space","enter"];
$('input').on('keypress',function(event) {
var unicode= event.keyCode ? event.keyCode : event.which;
if(unicode === triggers[triggerKeys]) {
//code initiation here
}
Though of course this doesn't work. Any ideas on how I could possibly make it so in the array of triggerKeys
the code is initiated, as well if they have more than one triggerKeys?
Code works for just one Trigger. Should I for loop the triggerKeys for more than one?