Press "Enter" to skip to content

Javascript Library That Creates Custom Keyboard Shortcuts

shortcuts.js is a JavaScript library for handling keyboard shortcuts that allows you to create events that are triggered by custom keyboard combinations.

javascript trigger keyboard shortcut, how to create keyboard shortcuts for websites, create shortcut using javascript, javascript hotkeys library

Modifier Keys

The following modifier keys are supported:

  • cmd (Mac only)
  • ctrl
  • alt
  • shift

How to make use of it:

Insert the “shortcuts.js” in the document.

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

Bind or link custom keyboard shortcuts and keystrokes as follows:

shortcuts.add('shift+up',function() {
    alert('You pressed shift+up')
})
shortcuts.add('ctrl+5',function() {
    document.body.style.background = "#ffff00";
})
shortcuts.add('alt+k',function() {
    document.getElementById("foobar").innerText = "Hello there Earthling!"; 
})

create custom keyboard shortcuts Plugin/Github, javascript ctrl key combination


See Demo And Download

Official Website(rickellis): Click Here

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

Be First to Comment

    Leave a Reply

    Your email address will not be published.