Here is a tested example of how to detect arrow keys press using JQuery.You can detect up key,down key,left and right key is pressed.

Here is a full code.Run these script in the firebug console.You can test this.