views:

132

answers:

1

in firefox when im inside a input textbox and press down the up/down arrow key it doesn't autorepeat. how can i make that happen and control how many keypress it will fire up per sec?

UPDATE: i use:

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

but it just execute the code one time..i would like it to repeat when holding down the down-arrow.

+1  A: 
Gaby
read my updated question
weng
I believe this will work in Firefox, but then won't work in Safari (and possibly other browsers) where keypress() works. I'm not aware of a plugin that selects the right one based on browser, but I'm guessing it's out there somewhere.
z5h
its the other way around. it doesnt work in FF but do work in Safari:/
weng
I have added an update with a working sample.. (works in all browsers but opera..)
Gaby
Arrow keys are not modifier keys and behave differently in terms of the events they fire in some browsers. For example, Firefox fires a `keypress` event for arrow keys but not for Shift.
Tim Down
@Tim, it fires a keypress.. but only one .. while the OP asks for a solution for continues events while the key is pressed.. I hear your though about the arrows not being modifiers..
Gaby
Yes, I understand the OP's problem and I've faced it myself before. There isn't an easy answer to it, cross-browser. My comment was just to highlight the different behaviours of Shift and arrow keys.
Tim Down