Press "Enter" to skip to content

Awesome Handling of Keyboard Events with JavaScript | jwerty.js

jwerty is a JS lib that allows you to concatenate, launch, and assert key combination strings against objects and events. It normalizes a weak API into something that’s easy to use and clear.

jwerty is a small library that weighs about 1.5KB minified and compressed (~3KB minified). jwerty does not have any dependencies but is compatible with jQuery, Zepto, Ender, or CanJS if you include these packages beside it.

keyboard events javascript, javascript keyboard events example, keydown event javascript, keyboardevent example, keyboard event typescript, react keyboard events

How to make use of it:

1. Insert the main JavaScript file jwerty.js just before the closing tag.

<script src="jwerty.js"></script>

2. Connect your callback function to the keyboard combination.

jwerty.key('ctrl+alt+A', function () { 
  // do something 
});

3. It also supports comma-separated key commas sequences.

jwerty.key('↑,↑,↓,↓,←,→,←,→,B,A,↩', function () { 
  // do something 
});

4. REGX is also supported.

jwerty.key('ctrl+[a-c]', function () { 
  // do something 
});

Handling Keyboard Events, jwerty Plugin/Github, new keyboardevent


See Demo And Download

Official Website(keithamus): Click Here

This superior jQuery/javascript plugin is developed by keithamus. For extra advanced usage, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.