[jQuery] missing keydown/keyup
Hi,
What I am trying to do, is figure out if there was a change in the
input field, so I want compare the value of the field before and after
a keypress.
And it works, but not when I type fast. Then the browser is just
losing some events.
This shows the problem:
<html>
<head>
<script type="text/javascript" src="js/jquery-1.2.1.pack.js"></script>
<script type="application/x-javascript">
$(function() {
$('#ap').bind('keydown', function()
{
console.log('down %o', this.value);
}).bind('keyup', function()
{
console.log('up %o', this.value);
});
});
</script>
</head>
<body>
<input type="text" id="ap"/>
</body>
</html>
When I type fast this is what I get in Firebug:
down ""
up "fr"
up "fr"
down "fr"
up "fran"
down "fran"
up "frank"
up "frank"
See how it skips the "down" event with r altogether?
Is there a way to solve this?
Thanks
Matt