Actually this one does the trick and works in all browsers:
if ((event.keyCode == 10 || event.keyCode == 13) && event.ctrlKey)
Link to js fiddle.
Notes:
- In Chrome on Windows and Linux, Enter would be registered as
keyCode
10, not 13 (bug report). So we need to check for either. ctrlKey
is control on Windows, Linux and macOS (not command). See alsometaKey
.