How do I trigger something when the cursor is within TEXTAREA and Ctrl+Enter is pressed?
I am using jQuery.
Advertisement
Answer
You can use the event.ctrlKey
flag to see if the Ctrl key is pressed. Something like this:
JavaScript
x
7
1
$('#textareaId').keydown(function (e) {
2
3
if (e.ctrlKey && e.keyCode == 13) {
4
// Ctrl + Enter pressed
5
}
6
});
7
Check the above snippet here.