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

    A look at why Dotcom Bubble comparisons to the AI boom are off, vertical SaaS is up +3% last 12 months vs. horizontal SaaS down 35%, and other reflections on AI (Logan Bartlett/@loganbartlett)

    March 29, 2026

    ios – How to change toolbar title color in SwiftUI when running on macOS Catalyst?

    March 29, 2026

    How Silver Fox preys on Japanese firms this tax season

    March 28, 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, 2025022 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

    Shadow AI : How to deal with unauthorized models and uncontrolled agents

    March 28, 2026

    Your Guide to Asynchronous Java

    March 28, 2026

    Your AI Coding Tool Has Amnesia

    March 27, 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    A look at why Dotcom Bubble comparisons to the AI boom are off, vertical SaaS is up +3% last 12 months vs. horizontal SaaS down 35%, and other reflections on AI (Logan Bartlett/@loganbartlett)

    March 29, 2026

    ios – How to change toolbar title color in SwiftUI when running on macOS Catalyst?

    March 29, 2026

    How Silver Fox preys on Japanese firms this tax season

    March 28, 2026

    Why DCIM still fails when data centres need it most

    March 28, 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!

    A look at why Dotcom Bubble comparisons to the AI boom are off, vertical SaaS is up +3% last 12 months vs. horizontal SaaS down 35%, and other reflections on AI (Logan Bartlett/@loganbartlett)

    March 29, 2026

    ios – How to change toolbar title color in SwiftUI when running on macOS Catalyst?

    March 29, 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.