I recently had an issue where I wanted to give the user the ability to press the Enter key after inputting the values that they wanted in an input field, in order to process it. This can be accomplished using JavaScript. In order to do this, we need to use KeyboardEvent which is part of the Web API.

We check that the user pressed the Enter key before doing any processing:

if (KeyboardEvent.key === 'Enter') {
    //do some action
}

For a list of other keys check the following link.