Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use a program for my music practice and it would be easier if I could use it with the keyboard buttons (PC). https://codepen.io/njmcode/pen/PwaXwB?editors=0010

I want to use the arrow keys to find the rhythm and Enter key to select the rhythm (Keydown 13).

What I have tried:

I have tried this but it doesn't work. (line 600 / js). Any idea?? Thanks in advance
Backbone
 events: {
      'click a': 'onPresetClick',
    'keydown a': 'keyAction'
    },

keyAction: function(e) {
  var code = e.keyCode || e.which;    
    if(code == 13) { 
      var id = $(e.currentTarget).attr('data-preset-id');
      this.$items.removeClass('active');
      $(e.currentTarget).addClass('active');
      dispatcher.trigger(dispatcher.EventKeys.PRESET_SELECTED, presets[id]);
    }
    },
Posted
Updated 23-Mar-22 20:44pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900