javascript - Unable to capture Ctrl+Alt+Arrow key event in jQuery - Stack Overflow

For some strange reasons I can't capture Ctrl+Alt+Arrow key bination inside textarea. Is it some s

For some strange reasons I can't capture Ctrl+Alt+Arrow key bination inside textarea. Is it some sort of system hotkey that is getting swallowed by Windows? Ctrl+Alt+Any Letter and Ctrl+Alt+Shift+Arrow are getting captured fine.

$(document).ready(function() {
    $("textarea").bind("keydown", function(event) {
        console.log(event);
        if(event.altKey && event.ctrlKey && event.which == 38) {
            console.log("ctrl+alt+up"); //never triggered
        }
    });
});

When Ctrl+Alt+Any Letter is pressed I see all 3 events in console. When Ctrl+Alt+Arrow is pressed I see only 2 events (for Ctrl and Alt).

Any ideas?

For some strange reasons I can't capture Ctrl+Alt+Arrow key bination inside textarea. Is it some sort of system hotkey that is getting swallowed by Windows? Ctrl+Alt+Any Letter and Ctrl+Alt+Shift+Arrow are getting captured fine.

$(document).ready(function() {
    $("textarea").bind("keydown", function(event) {
        console.log(event);
        if(event.altKey && event.ctrlKey && event.which == 38) {
            console.log("ctrl+alt+up"); //never triggered
        }
    });
});

When Ctrl+Alt+Any Letter is pressed I see all 3 events in console. When Ctrl+Alt+Arrow is pressed I see only 2 events (for Ctrl and Alt).

Any ideas?

Share Improve this question edited Jan 27, 2022 at 18:17 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Aug 10, 2010 at 20:22 sergserg 111k78 gold badges325 silver badges337 bronze badges 4
  • 3 My God. Ctrl+Alt+Arrow rotates my entire screen in the direction of the arrow key pressed. How did I not know about this awesomeness??? – MooGoo Commented Aug 10, 2010 at 20:43
  • @MooGoo which OS? I don't see anything like that on Vista. – serg Commented Aug 10, 2010 at 20:47
  • Vista. Though it may be something to do with the Lenovo bloatware on it. – MooGoo Commented Aug 10, 2010 at 21:06
  • 1 I think ATI graphic cards had such app that allowed to rotate the screen – Jarek Commented Aug 10, 2010 at 21:13
Add a ment  | 

1 Answer 1

Reset to default 5

I've just checked your code and everything works just fine in IE8, Firefox and Chrome. What browser are you using?

Have you tried using jquery hotkeys plugin ?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745223076a4617338.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信