I need to detect the case of characters in event keydown and keyup
$('body').keydown(
function(event) {
var charCode = (event.which) ? event.which : event.keyCode;
var char = String.fromCharCode(charCode);
console.log(char + " is down pressed");
}
);
$('body').keyup(
function(event) {
var charCode = (event.which) ? event.which : event.keyCode;
var char = String.fromCharCode(charCode);
console.log(char + " is up pressed");
}
);
You may try it here: http://jsfiddle.net/8dqwW/
It's always returning the upper case letter even if no caps lock is pressed.
How can I detect the letter pressed with its case, either upper or lower in those two events ?
keyup
and keydown
cannot detect the upper/lower case.
Only keypress
can do so !