Skip to content

Instantly share code, notes, and snippets.

@marcojetson
Created October 8, 2016 09:51
Show Gist options
  • Save marcojetson/3f0dbd9c971013fafffcb29a0955cb52 to your computer and use it in GitHub Desktop.
Save marcojetson/3f0dbd9c971013fafffcb29a0955cb52 to your computer and use it in GitHub Desktop.
Key shortcut configuration macOS alike
$('input').keydown(function (e) {
e.preventDefault();
var keys = [];
e.altKey && keys.push('⌥');
e.ctrlKey && keys.push('⌃');
e.metaKey && keys.push('⌘');
e.shiftKey && keys.push('⇧');
keys.push(String.fromCharCode(e.which));
this.value = keys.join('');
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment