Auto repeat up / down arrow?

in firefox, when im inside the input text box and press the up / down arrow key, it does not perform auto-repeat. How can I do this and control how many clicks does it fire per second?

UPDATE: I use:

$('#search_view #search').live('keydown', function(event) { if(event.keyCode == 40) { // code } }); 

but it just executes the code once. I would like it to repeat while holding downward arrow.

+4
source share
1 answer

Use .keydown() instead.

quote from jQuery . keypress ()

In addition, modifier keys (such as Shift) trigger key change events, but not keypress events.

Fall arrows do not fall into the same category as Shift, but are handled in a special way ... keydown will do the trick.

Update

After your comment, here is an example that works in

  • FF 3.5.x and 3.0.11
  • IE 6, 7
  • Google Chrome 4.0.x
  • Safari 4.0.4

It works not only in Opera (Edit: works in Opera 12.16), but it does not work with any key, not with arrows.

About speed you cannot change it from your code .. this is a system parameter (from the BIOS and from the keyboard settings in the control panel -windows-)

+1
source

Source: https://habr.com/ru/post/1301274/


All Articles