KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The next sample code outputs 'keydown' message many times while I hold a button down. The docs says that the keydown event happens once for one push of the button. So, the keydown event works like the keypress event in the next example. <!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title></title> <script type='text/javascript' src='jquery.js'></script> <script type='text/javascript'> function onLoad() { $( '#text' ).on( 'keydown', function() { console.info( 'keydown' ) } ); } </script> </head> <body onload='onLoad()'> <input type='text' id='text'> </body> </html> I tested it on Windows, Firefox 19.0.2 and Google Chrome 25.0.1364.152. Also I created a fiddle (the problem can be reproduced). JQuery versions for which problem is reproduced: 1.8.2, 1.9.1. Update. I did realize the problem: How can I avoid autorepeated keydown events in JavaScript? .
Tags (comma-separated)
Save Edits
Cancel