This works fine for me :
$(document).keypress(function (e){
if(e.keyCode == 37) // left arrow
{
// your action here, for example
$('#buttonPrevious').click();
}
else if(e.keyCode == 39) // right arrow
{
// your action here, for example
$('#buttonNext').click();
}
});