How to enable / disable the Caps lock key

We may find that the Caps lock key is on / off using jQuery. My question is:

"we can enable / disable the Caps lock key using jQuery or Javascript in the Keypress event."

And also using C # how to do this?

Thanks in advance!

0
source share
4 answers

You cannot change whether the lock key is on or off. However, you can change whether your input strings will be lower or upper case with Javascript based on whether the lock key is on or off.

for (char in inputString) { if(capslock) { // do your caps lock detection here if(char === char.toUpperCase()) { // it upper case char = char.toLowerCase(); } else { char = char.toUpperCase(); } } } 
+4
source

You cannot do this jquery since javascript will be isolated in the browser.

+2
source

Detection Only:

 $('#id').keypress(function(e) { var s = String.fromCharCode( e.which ); if ( s.toUpperCase() === s && s.toLowerCase() !== s && !e.shiftKey ) { alert('caps is on'); } }); 
0
source

If it were possible, I would be able to control the sound volume of the user or, perhaps, check what is on his hard drive, I can be more curious and monitor his network traffic ...
I would have the world itself with a simple JavaScript file :)

0
source

All Articles