event.key
and modern JS!$(document).keypress(function(event) {
if (event.key === "Enter") {
// Do something
}
});
or without jQuery:
document.addEventListener("keypress", function onEvent(event) {
if (event.key === "Enter") {
// Do something better
}
});