Users can easily spot unwanted caps lock when typing in most inputs, but when using a password input , the problem isn't so obvious. To detect if a user has their keyboard's caps lock turn on, we'll employ KeyboardEvent 's getModifierState method: 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? }