Capture an Enter Key Pressed anywhere on the page

Solution 1:

$(document).keypress(function(e) {
  if(e.which == 13) {
    // enter pressed
  }
});

Solution 2:

The keydown event is fired when a key is pressed down.
The keypress event is fired when a key is pressed down and that key normally produces a character value.

$(document).keydown( function(event) {
  if (event.which === 13) {
    // login code here
  }
});