check if enter key is pressed jquery

JavaScript
$(document).on('keypress',function(e) {
    if(e.which == 13) {
        alert('You pressed enter!');
    }
});
Source

Also in JavaScript: