I'm trying to get an event going when pressing specific keys.
The keys I'm trying to listen to are bltzr and on my browser I can only press bltz but not the last r.
I'm trying this on Windows, I have tried on OSX and I still can't listen to all the keys pressed. However the error is different (can't tell you more about it because it wasn't my device)
This is the code I'm using to listen if keys are pressed :
var log = $('#log')[0], pressedKeys = []; $(document.body).keydown(function (evt) { var li = pressedKeys[evt.keyCode]; if (!li) { li = log.appendChild(document.createElement('li')); pressedKeys[evt.keyCode] = li; } $(li).text('Down: ' + evt.keyCode); $(li).removeClass('key-up'); }); $(document.body).keyup(function (evt) { var li = pressedKeys[evt.keyCode]; if (!li) { li = log.appendChild(document.createElement('li')); } $(li).text('Up: ' + evt.keyCode); $(li).addClass('key-up'); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <ul id="log"> <li>List of keys:</li> </ul> Why can I not see these specific keys down at the same time ?
Is there a way to listen to all of them at the same time ?
var log = $('#log')[0],. Only $('#log') will be enough