Detecting enter on input


#1

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


#2

For example:

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

#3

Perfect! Many thanks