jquery prevent enter from submitting

Developer from somewhere

When trying to catch enter in a submit, the following did the trick:

    $(document).on 'keypress keydown keyup', '#elem', (e) ->
     if e.which == 13
       # whatever logic
       e.preventDefault()