I'm making an application that needs to detect whether or not the CTRL key was pressed.
My code is as follows:
document.addEventListener('keydown', function(event) {
if (event.keyCode != 13 || event.keyCode != 38 || event.keyCode != 40 || event.keyCode != 17)
{
// execute this
}
(The CTRL key is the last keycode in that if statement.)
After searching the internet it says to use 17 as the keycode, but it is still EXECUTING "// Execute this" if i press CTRL. It's not supposed to execute it.
All other keys work properly in the if statement, and I'm using Chrome 31 stable/official.
I am also using 'keydown' and not 'keypress' as you can see.
Thanks in advance for help!