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

    ios – Background Assets Framework server connection problem

    December 27, 2025

    FaZe Clan’s future is uncertain after influencers depart

    December 27, 2025

    Airbus prepares tender for European sovereign cloud

    December 27, 2025
    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

    Patronus AI announces Generative Simulators to provide adaptive training environments to agents

    December 27, 2025

    Why flaky tests are increasing, and what you can do about it

    December 26, 2025

    Why AI isn’t replacing UX designers – it’s making them indispensable

    December 25, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    ios – Background Assets Framework server connection problem

    December 27, 2025

    FaZe Clan’s future is uncertain after influencers depart

    December 27, 2025

    Airbus prepares tender for European sovereign cloud

    December 27, 2025

    Indie App Spotlight: ‘Cannot Ignore’ brings full screen alarms to your calendar and more

    December 27, 2025
    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!

    ios – Background Assets Framework server connection problem

    December 27, 2025

    FaZe Clan’s future is uncertain after influencers depart

    December 27, 2025

    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
      © 2025 bigteetechhub.All Right Reserved

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