Detecting enter on input

I want to trigger some javascript when an input field receives ‘enter’ but do nothing if the entry is anything else.
Ideas for a simple solution appreciated.
thanks

For example:

$('input').on('keydown', function (e) {
  if (e.keyCode === 13) {
    // enter pressed
  }
})
1 Like

Perfect! Many thanks