Difference between keypress() and keydown() events
Press any key to check the event and the keycode. Non-printing keys like Esc, Shift key , Delete key etc are not triggered by keypress() event. keydown() event is case insensitive keypress() event is case sensitive
Press any char key and see the difference between keycodes, keep the caps Lock in on position and check again.
keydown event details here
keypress event details here
If you are using arrow keys then you must use keydown() event as keypress() event can't sesnse arrow key events.
event.which : will display the keycode or ASCII value of the key.
Full Source code is here