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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -