• 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

Admin by Admin
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
Admin

Admin

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 Vibrant Spring 2025 Kitchen Decor Colours and Equipment – Chefio

Discover Vibrant Spring 2025 Kitchen Decor Colours and Equipment – Chefio

May 17, 2025
Reconeyez Launches New Web site | SDM Journal

Reconeyez Launches New Web site | SDM Journal

May 15, 2025
Safety Amplified: Audio’s Affect Speaks Volumes About Preventive Safety

Safety Amplified: Audio’s Affect Speaks Volumes About Preventive Safety

May 18, 2025
Flip Your Toilet Right into a Good Oasis

Flip Your Toilet Right into a Good Oasis

May 15, 2025
Apollo joins the Works With House Assistant Program

Apollo joins the Works With House Assistant Program

May 17, 2025

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

Monopoly Go advert brings again Will Ferrell as Mr Monopoly wrapped in a whole lot of 90s TV sitcom nostalgia

Monopoly Go advert brings again Will Ferrell as Mr Monopoly wrapped in a whole lot of 90s TV sitcom nostalgia

July 10, 2025
Carnegie Mellon College at ICML 2025 – Machine Studying Weblog | ML@CMU

Carnegie Mellon College at ICML 2025 – Machine Studying Weblog | ML@CMU

July 10, 2025
  • 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