jquery.keycombinator

jquery.keycombinator is a do-it-all plugin to let your users define keyboard shortcuts. Simply slap it onto an input box and it will detect any entered key combinations and provide detailed data in a callback function, with OS-specific key symbols. You can then pass that data on to key handler plugins such as jwerty. Try it out!

Download (.zip) | Download (.tar.gz) | View Docs and Code on Github | Author's homepage

Basic Usage

Enter a key combination

Output


    

Source

$('#keyComboInput1').makeKeyCombinator({
  onComplete: function(keyComboData){
    $('#output1').html(JSON.stringify(keyComboData, null, 2));
  }
});
      

With "clear" and "reset to default" functionality

Enter a key combination

Output


    

Source

$('#keyComboInput2').makeKeyCombinator({
  defaultCombos: {
    mac: ['⌃', '⇧', 'F'],
    win: ['Ctrl', 'Shift', 'F'],
    unix: ['Ctrl', 'Shift', 'F']
  },
  onComplete: function(keyComboData){
    $('#output2').html(JSON.stringify(keyComboData, null, 2));
  }
});

$('#clearBtn').click(function(){
  $('#keyComboInput2').clearKeyCombinator();
});
$('#resetBtn').click(function(){
  $('#keyComboInput2').defaultKeyCombinator();
});