Created
October 8, 2016 09:51
-
-
Save marcojetson/3f0dbd9c971013fafffcb29a0955cb52 to your computer and use it in GitHub Desktop.
Key shortcut configuration macOS alike
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('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