- when a text box is on focus, how can I make a listen to a down and up arrow press?
- how can I get the focus on an element using codes?
Update
I want this for an auto-complete search. It’s working; all I want now when the down arrow key is pressed while typing, the focus moves to the drop-down list.
You could subscribe to the
onkeydownevent:and inside the function check the key code to identify which key was pressed using the code:
and here’s a demo.
As far as setting the focus to a given element is concerned you could use the
focus()function: