Created
March 13, 2024 01:51
-
-
Save corypina/4692aa7b0dd41a80bb6d55d9a41a6533 to your computer and use it in GitHub Desktop.
Detect caps lock
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
// via https://davidwalsh.name/detect-caps-lock | |
document.querySelector('input[type=password]').addEventListener('keyup', function (keyboardEvent) { | |
const capsLockOn = keyboardEvent.getModifierState('CapsLock'); | |
if (capsLockOn) { | |
// Warn the user that their caps lock is on? | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment