In this video I’ll take you through how to easily detect if CAPS LOCK is enabled with JavaScript – it’s super easy to do with KeyboardEvent.getModifierState().
The example used in this video involves an HTML form and basically we’ll be adding a simple message that warns the user that CAPS LOCK is in fact on.
Support me on Patreon:
https://www.patreon.com/dcode – with enough funding I plan to develop a website of some sort with a new developer experience!
For your reference, check this out:
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState
Follow me on Twitter @dcode!
If this video helped you out and you’d like to see more, make sure to leave a like and subscribe to dcode!
Original source
4 responses to “Detecting CAPS LOCK on HTML forms – JavaScript Tutorial”
onload will not work. How to do in simple way ?
what is your visual code theme?
Cool
Ty!