I have 2 challenges,
On page load, I would like to show a warning saying that "caps is on".
Still the user press the shift + key or Caps on + key - I would like to through error.
I search in google and find a solution, but it doesn't work. any one help me to sort this issue please? please refresh the page using caps lock on/off to get the current status. nothing works.
Here is the function I got from google search:
function capLock(e){
kc = e.keyCode?e.keyCode:e.which;
sk = e.shiftKey?e.shiftKey:((kc == 16)?true:false);
if(((kc >= 65 && kc <= 90) && !sk)||((kc >= 97 && kc <= 122) && sk))
console.log('caps lock on')
else
console.log('caps lock off');
}
$('#password').on('keypress', function(e){
capLock(e.which)
})