Author: | arjndr |
---|---|
Views Total: | 198 views |
Official Page: | Go to website |
Last Update: | January 29, 2018 |
License: | MIT |
Preview:

Description:
ShortcutsJS is a small JavaScript library that listens for keypress events and binds custom keypress events using the CustomEvent API.
How to use it:
Import the minified version of the ShortcutsJS library into the document.
<script src="shortcuts.js"></script>
Specify the element where you want to listen for the keypress events.
<input type="text" id="demo">
var inputShortcut = new Shortcuts(document.getElementById('inp'));
Bind a custom Keyboard Combination (shortcut) event to the input field when typed.
document.getElementById('inp').addEventListener('Ctrl+R', function(){ alert('done'); });