jShortcuts is free, lightweight and easy to use JavaScript shortcuts library. It is compatible with all modern web browsers and does not require other JavaScript libraries / frameworks.
jShortcuts: Quick Start
Copy & paste following code to your web page and you are ready to go. This demo code registers three demo keyboard shortcuts:
- Ctrl+M (built-in menu demo): displays built-in shortcut menu (you can style it with your own CSS style)
- Ctrl+F9 (callback shortcut demo): calls callback JavaScript method
- Ctrl+Shift+G (URL shortcut demo): opens Google page in new window
<html><head></head><body>
<div>your content</div>
<!--put this at the end of your page-->
<script type="text/javascript"
src="http://www.sublight.me/Projects/jShortcuts/Download/jshortcuts-1.0.0.js">
</script>
<script type="text/javascript">
jShortcuts.register([
//displays built-in menu
jShortcuts.createMenuShortcut('Ctrl+M'),
//simulates button click
//jShortcuts.createElementShortcut('nextButton', 'Next Page', 'Ctrl+Shift+N'),
//fires callback method
jShortcuts.createCallbackShortcut(function () {
alert('test from shortcut callback');
}, 'Callback test', 'Ctrl+F9'),
//opens new page
jShortcuts.createUrlShortcut('www.google.com', 'Visit Google', 'Ctrl+Shift+G')
]);
</script>
</body></html>
jShortcuts: Free Download
jShortcuts: Questions or Comments?
Please contact us