jquery - In Javascript, How to detect the character case (upper/lower) in keydown & keyup events? -
i need detect case of characters in event keydown , keyup
here's code:
$('body').keydown( function(event) { var charcode = (event.which) ? event.which : event.keycode; var char = string.fromcharcode(charcode); console.log(char + " down pressed"); } ); $('body').keyup( function(event) { var charcode = (event.which) ? event.which : event.keycode; var char = string.fromcharcode(charcode); console.log(char + " pressed"); } );
you may try here: http://jsfiddle.net/8dqww/
it's returning upper case letter if no caps lock pressed.
how detect letter pressed case, either upper or lower in 2 events ?
keyup
, keydown
cannot detect upper/lower case.
only keypress
can !
Comments
Post a Comment