Close Menu
  • Home
  • AI
  • Big Data
  • Cloud Computing
  • iOS Development
  • IoT
  • IT/ Cybersecurity
  • Tech
    • Nanotechnology
    • Green Technology
    • Apple
    • Software Development
    • Software Engineering

Subscribe to Updates

Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

    What's Hot

    Laurence Fournier Beaudry and Guillaume Cizeron are on the brink of a controversial Olympic ice dance gold

    February 11, 2026

    iOS 26, using Swift, how can I group multiple Liquid Glass buttons into a single pill view?

    February 11, 2026

    One platform for the Agentic AI era

    February 11, 2026
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Big Tee Tech Hub
    • Home
    • AI
    • Big Data
    • Cloud Computing
    • iOS Development
    • IoT
    • IT/ Cybersecurity
    • Tech
      • Nanotechnology
      • Green Technology
      • Apple
      • Software Development
      • Software Engineering
    Big Tee Tech Hub
    Home»Software Development»Detect Caps Lock with JavaScript
    Software Development

    Detect Caps Lock with JavaScript

    big tee tech hubBy big tee tech hubJune 28, 2025002 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    Detect Caps Lock with JavaScript
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link

    Anyone is capable of having their caps lock key on at any given time without realizing so. Users can easily spot unwanted caps lock when typing in most inputs, but when using a password input, the problem isn’t so obvious. That leads to the user’s password being incorrect, which is an annoyance. Ideally developers could let the user know their caps lock key is activated.

    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?
        }
    });
    

    I’d never seen getModifierState used before, so I explored the W3C documentation to discover other useful values:

    dictionary EventModifierInit : UIEventInit {
      boolean ctrlKey = false;
      boolean shiftKey = false;
      boolean altKey = false;
      boolean metaKey = false;
    
      boolean modifierAltGraph = false;
      boolean modifierCapsLock = false;
      boolean modifierFn = false;
      boolean modifierFnLock = false;
      boolean modifierHyper = false;
      boolean modifierNumLock = false;
      boolean modifierScrollLock = false;
      boolean modifierSuper = false;
      boolean modifierSymbol = false;
      boolean modifierSymbolLock = false;
    };
    

    getModifierState provides a wealth of insight as to the user’s keyboard during key-centric events. I wish I had known about getModifier earlier in my career!

    Request Metrics real user monitoring
    Request Metrics real user monitoring
    Request Metrics real user monitoring
    Request Metrics real user monitoring
    • Camera and Video Control with HTML5

      Camera and Video Control with HTML5

      Client-side APIs on mobile and desktop devices are quickly providing the same APIs.  Of course our mobile devices got access to some of these APIs first, but those APIs are slowly making their way to the desktop.  One of those APIs is the getUserMedia API…

    • CSS Animations Between Media Queries

      CSS Animations Between Media Queries

      CSS animations are right up there with sliced bread. CSS animations are efficient because they can be hardware accelerated, they require no JavaScript overhead, and they are composed of very little CSS code. Quite often we add CSS transforms to elements via CSS during…

    • Flext: MooTools Auto-Growing Textrea Plugin
    • CSS Filters

      CSS Filters

      CSS filter support recently landed within WebKit nightlies. CSS filters provide a method for modifying the rendering of a basic DOM element, image, or video. CSS filters allow for blurring, warping, and modifying the color intensity of elements. Let’s have…



    Source link
    Caps detect JavaScript lock
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    How to Build Solana Trading Bots

    February 10, 2026

    People don’t belong in the loop — They belong at the center

    February 10, 2026

    Is the craft dead? – Scott Hanselman’s Blog

    February 9, 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    Laurence Fournier Beaudry and Guillaume Cizeron are on the brink of a controversial Olympic ice dance gold

    February 11, 2026

    iOS 26, using Swift, how can I group multiple Liquid Glass buttons into a single pill view?

    February 11, 2026

    One platform for the Agentic AI era

    February 11, 2026

    An ice dance duo skated to AI music at the Olympics

    February 11, 2026
    About Us
    About Us

    Welcome To big tee tech hub. Big tee tech hub is a Professional seo tools Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of seo tools, with a focus on dependability and tools. We’re working to turn our passion for seo tools into a booming online website. We hope you enjoy our seo tools as much as we enjoy offering them to you.

    Don't Miss!

    Laurence Fournier Beaudry and Guillaume Cizeron are on the brink of a controversial Olympic ice dance gold

    February 11, 2026

    iOS 26, using Swift, how can I group multiple Liquid Glass buttons into a single pill view?

    February 11, 2026

    Subscribe to Updates

    Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

      • About Us
      • Contact Us
      • Disclaimer
      • Privacy Policy
      • Terms and Conditions
      © 2026 bigteetechhub.All Right Reserved

      Type above and press Enter to search. Press Esc to cancel.