How to detect that Ctrl+R was pressed?

后端 未结 10 870
逝去的感伤
逝去的感伤 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 15:08

    We can also use Ascii code for finding the characters as well as the characters

    $('html').keydown(function (e) {
         keydownfunc(e);
    });
    function keydownfunc(e) {
       if (e.ctrlKey && (e.key === "r" || e.key === "R")) {
           alert("ctrl+R");
       }
        }
    

提交回复
热议问题