How do I trigger something when the cursor is within TEXTAREA and Ctrl+Enter is pressed? Using jQuery. Thanks
A:
first you have to set a flag when Cntr is pressed, do this onkeydown. then you have to check the keydown of enter. unset the flag when you see a keyup for cntrl.
mkoryak
2009-11-05 22:47:40
+8
A:
You can use the event.ctrlKey
flag to see if the Ctrl key is pressed, something like this:
$('#textareaId').keydown(function (e) {
if (e.ctrlKey && e.keyCode == 13) {
// Ctrl-Enter pressed
}
});
Check the above snippet here.
CMS
2009-11-05 22:55:19
A:
$('my_text_area').focus(function{ set_focus_flag });
//ctrl on key down set flag
//enter on key down = check focus flag, check ctrl flag
idrumgood
2009-11-05 22:56:23