2

I have not used jquery.hotkeys.js in a while, but I cant seem to get even the most basic test to work in any current browsers.

Using Ver 0.8 I also tried with other versions of jQuery but stuck with 1.4.2 for testing since that was what John Resig had in his examples.

<html>
<head>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script src="/js/jquery.hotkeys.js"></script>
    <script>
        jQuery(document).ready(function(){            
            $(document).bind('keydown', "f", function() {
                alert("click");
                return false;
            });     
        });    
    </script>
</head>
<body>

Alex
  • 1,535
  • 2
  • 16
  • 26
  • 1
    as per the question here - http://stackoverflow.com/questions/18907673/latest-version-of-jquery-hotkeys-plugin-doesnt-accept-characters-unless-using-k only the "keypress" event works. – Alex Oct 25 '13 at 17:33

1 Answers1

1

I don't know about the bind aspect, but this seems to work for me

     $(document).keydown(function (event) {
         if (event.ctrlKey && event.keyCode == 90) {
             alert('hi, you just pressed ctrl-z');
         }
     });

full code here:

<html>
<head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script>
       $(document).ready(function () { alert('1st'); });
         $(document).keydown(function (event) {
             if (event.ctrlKey && event.keyCode == 90) {
                  alert('hi, you just pressed ctrl-z');
             }
         });

    </script>
</head>
<body>
rwg
  • 915
  • 9
  • 12