Suppose I have 10 texboxes in one page & want to get focus of particular texbox by just pressing particular key on keyboard. Is it possible?
Asked
Active
Viewed 505 times
-1
-
1Yes, that's possible. – Cerbrus Dec 06 '17 at 10:18
-
1what have you tried? what issue you have landed on? – Kiran Dash Dec 06 '17 at 10:18
-
You can use `tabindex` property in html. Use `tab` key to focus it. – Madhavan.V Dec 06 '17 at 10:18
-
you can use the window.onkeyup function to listen for keypresses, then inspect which key has been pressed and set the focus to the desired element – Thomas Powell Dec 06 '17 at 10:19
-
@KiranDash I didn't tried anything because I don't know whether it is possible or not. – SUN Dec 06 '17 at 10:20
-
@ThomasPowell can you show me example in answer? – SUN Dec 06 '17 at 10:20
-
@SUN . It is possible. Have a look at the duplicate mentioned by Cerbrus. – Kiran Dash Dec 06 '17 at 10:22
1 Answers
0
Yes, Listen to keyboard events, just call $("#item_id").focus()
inside your keyevent handler

Akhil Thayyil
- 9,263
- 6
- 34
- 48