Javascript (JQuery) keyboard hijack problem
Posted
by user266564
on Stack Overflow
See other posts from Stack Overflow
or by user266564
Published on 2010-04-17T15:13:18Z
Indexed on
2010/04/17
15:23 UTC
Read the original article
Hit count: 298
I'm making a typing tutor program using javascript. Everything is going well except that if activates browser hotkeys which disrupts the functionality of the program. When I press the single quote in Firefox it triggers "Quick find (links only)" short cut and in all browsers when I press space the page scrolls down a page. Everything is working fine outside of this. Here's the code in the head:
<script type="text/javascript">
$(document).ready(function() {
executeType();
});
</script>
And the code I am using to capture the keyboard (simplified, but tested):
function executeType() {
$(document).keydown(function(event) {
alert(event.keyCode);
});
}
© Stack Overflow or respective owner