How do I trigger something when the cursor is within TEXTAREA and Ctrl+Enter is pressed? Using jQuery. Thanks
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:
keyCode
10, not 13 (bug report). So we need to check for either.ctrlKey
is control on Windows, Linux and macOS (not command). See also metaKey
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With