• About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us
TechTrendFeed
  • Home
  • Tech News
  • Cybersecurity
  • Software
  • Gaming
  • Machine Learning
  • Smart Home & IoT
No Result
View All Result
  • Home
  • Tech News
  • Cybersecurity
  • Software
  • Gaming
  • Machine Learning
  • Smart Home & IoT
No Result
View All Result
TechTrendFeed
No Result
View All Result

Detect Caps Lock with JavaScript

Aarav Kapoor by Aarav Kapoor
May 23, 2025
Home Software
Share on FacebookShare on Twitter

Anybody is able to having their caps lock key on at any given time with out realizing so. Customers can simply spot undesirable caps lock when typing in most inputs, however when utilizing a password enter, the issue is not so apparent. That results in the person’s password being incorrect, which is an annoyance. Ideally builders may let the person know their caps lock secret is activated.

To detect if a person has their keyboard’s caps lock activate, we’ll make use of KeyboardEvent‘s getModifierState technique:

doc.querySelector('enter[type=password]').addEventListener('keyup', perform (keyboardEvent) {
    const capsLockOn = keyboardEvent.getModifierState('CapsLock');
    if (capsLockOn) {
        // Warn the person that their caps lock is on?
    }
});

I would by no means seen getModifierState used earlier than, so I explored the W3C documentation to find different helpful 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 supplies a wealth of perception as to the person’s keyboard throughout key-centric occasions. I want I had identified about getModifier earlier in my profession!

Request Metrics real user monitoring
Request Metrics real user monitoring
Request Metrics real user monitoring
Request Metrics real user monitoring
  • fetch API

    fetch API

    One of many worst stored secrets and techniques about AJAX on the internet is that the underlying API for it, XMLHttpRequest, wasn’t actually made for what we have been utilizing it for.  We have accomplished properly to create elegant APIs round XHR however we all know we are able to do higher.  Our effort to…

  • Create a CSS Flipping Animation

    Create a CSS Flipping Animation

    CSS animations are loads of enjoyable; the fantastic thing about them is that by way of many easy properties, you possibly can create something from a sublime fade in to a WTF-Pixar-would-be-proud impact. One CSS impact someplace in between is the CSS flip impact, whereby there’s…

  • Digg-Style Dynamic Share Widget Using the Dojo Toolkit

    Digg-Type Dynamic Share Widget Utilizing the Dojo Toolkit

    I’ve all the time seen Digg as a really progressive web site. Digg makes use of experimental, ajaxified strategies for feedback and mission-critical capabilities. One good contact Digg has added to their web site is their hover share widget. Here is easy methods to implement that performance in your website…

  • Introducing MooTools LinkAlert

    Introducing MooTools LinkAlert

    One in every of my favourite Firefox plugins is known as LinkAlert. LinkAlert reveals the person an icon once they hover over a particular hyperlink, like a hyperlink to a Microsoft Phrase DOC or a PDF file. I like that warning as a result of I hate the shock…


Tags: CapsdetectJavascriptLock
Aarav Kapoor

Aarav Kapoor

Aarav Kapoor covers the latest in technology, gadgets, cybersecurity, software and smart home trends for TechTrendFeed. He breaks down complex tech news into clear, practical insights for everyday readers.

Next Post
Cognyte Provides GroupSense in $4M Risk Intelligence Deal

Cognyte Provides GroupSense in $4M Risk Intelligence Deal

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Trending.

Discover a Software program Improvement Firm in Europe

Discover a Software program Improvement Firm in Europe

August 22, 2025
Constructing cyber-resilient AI within the enterprise

Constructing cyber-resilient AI within the enterprise

September 14, 2026
The House Assistant survey dataset – Open House Basis

The House Assistant survey dataset – Open House Basis

August 29, 2026
KV Cache Administration: PagedAttention & RadixAttention

KV Cache Administration: PagedAttention & RadixAttention

August 23, 2026
Consider any agent framework with Amazon Bedrock AgentCore Evaluations

Consider any agent framework with Amazon Bedrock AgentCore Evaluations

August 27, 2026

TechTrendFeed

Welcome to TechTrendFeed, your go-to source for the latest news and insights from the world of technology. Our mission is to bring you the most relevant and up-to-date information on everything tech-related, from machine learning and artificial intelligence to cybersecurity, gaming, and the exciting world of smart home technology and IoT.

Categories

  • Cybersecurity
  • Gaming
  • Machine Learning
  • Smart Home & IoT
  • Software
  • Tech News

Recent News

Nail your narrative

Nail your narrative

September 17, 2026
Elevate Your Modern Home with LED Rose Lamps and West Elm Decor Ideas of 2026 – Chefio

Elevate Your Modern Home with LED Rose Lamps and West Elm Decor Ideas of 2026 – Chefio

September 16, 2026
  • About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us

© 2025 https://techtrendfeed.com/ - All Rights Reserved

No Result
View All Result
  • Home
  • Tech News
  • Cybersecurity
  • Software
  • Gaming
  • Machine Learning
  • Smart Home & IoT

© 2025 https://techtrendfeed.com/ - All Rights Reserved