I was wondering if it was possible to know if the caps lock button is active while filling a web form ?
Sometimes, when you are asked to enter your password, softwares notice you that's active, and you be careful.
I would have liked to do the same in web forms.
Any ideas ?
The following jQuery snippet detects whether caps lock is enabled upon keypress:
$('#example').keypress(function(e) {
var s = String.fromCharCode( e.which );
if ( s.toUpperCase() === s && s.toLowerCase() !== s && !e.shiftKey ) {
alert('caps is on');
}
});
Taken from StackOverflow answer: https://stackoverflow.com/a/896515/1113435
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With