How to detect that Ctrl+R was pressed?

后端 未结 10 871
逝去的感伤
逝去的感伤 2020-12-08 14:27

I\'m coding a function in jquery that executes if Ctrl+R is pressed but I can\'t seem to find out what the left and right ctrl keycodes are... Can some

10条回答
  •  长情又很酷
    2020-12-08 14:54

     $(document).ready(function () {
         $(document).keyup(function (e) {
             if (e.keyCode == 81 && e.ctrlKey) { //CTRL+Q
                 alert("CTRL+Q");
             } else if (e.keyCode == 27) { //ESCAPE
                 alert("escape");
             } else if (e.keyCode == 67 && e.altKey) { // ALT+C
               alert("ALT+C");
            }     
        });
    });
    

    key codes

提交回复
热议问题