This code issues a warning if I press a key Ctrl:
$('#text').bind('keypress', function(e) { if(e.keyCode==17) { alert("Boo ya"); } });
To prevent a warning if only the key is pressed left Ctrl?
You cannot at least use keyCode. For both keys there will be 17. I do not know another method to distinguish between the two, and, in my opinion, it is unlikely that there is one.
I know this question is pretty old, but today seems possible
$('#text').on("keyup",function(e) { console.log(e.originalEvent.code); var myKey = e.originalEvent.code; if( myKey == 'ControlLeft' ) { alert('hello left control'); } });