Reputation: 1515
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>
Upvotes: 2
Views: 937
Reputation: 934
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>
Upvotes: 1