Created
May 11, 2020 22:44
-
-
Save angeloped/af01b3baeaad5814518451c7ab6d4344 to your computer and use it in GitHub Desktop.
Replace keyboard characters by keydown.
This file contains hidden or 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
$('textarea').on('keydown', function(e){ | |
console.log(e.keyCode); | |
if( e.keyCode == 90 ){ | |
e.preventDefault(); | |
$(this).append('y').focus(); | |
} | |
if( e.keyCode == 89 ){ | |
e.preventDefault(); | |
$(this).append('z').focus(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment