I'm making a code in javascript right now its really beyond simple but I honestly know nothing about javascript i've been learning for maybe 4 days. so basically I just need a while loop that presses tab every time it loops.
Asked
Active
Viewed 126 times
-2
-
Maybe [this question](http://stackoverflow.com/questions/596481/simulate-javascript-key-events) will help you – Alvaro Flaño Larrondo Oct 06 '15 at 21:43
-
@5austen Please elaborate your question. If possible add a code, which will help to understand the query. – Jaffer Wilson Oct 06 '15 at 21:44
-
What are you trying to accomplish by "pressing tab" every time it loops? Insert a tab character? Advance focus to the next element? – arcyqwerty Oct 06 '15 at 21:45
-
im trying to advance focus. – 5austen Oct 06 '15 at 21:50
-
oh hey thanks that solves the problem i guess i should have looked harder – 5austen Oct 06 '15 at 21:57
1 Answers
0
Focus Next Element In Tab Index provides code for advancing focus to the next tabIndexed element.
Or if you're not using tabindex, then it would simply be the next focusable area
Exactly which elements qualify to be focusable areas appears to be platform dependent although there is a recommended list:
Modulo platform conventions, it is suggested that for the following elements, the tabindex focus flag be set:
- a elements that have an href attribute
- link elements that have an href attribute
- button elements
- input elements whose type attribute are not in the Hidden state
- select elements
- textarea elements
- menuitem elements
- Elements with a draggable attribute set, if that would enable the user agent to allow the user to begin a drag operations for those elements without the use of a pointing device
- Editing hosts
- Browsing context containers
- Sorting interface th elements
Here's some good general information regarding focus: https://html.spec.whatwg.org/multipage/interaction.html#focus

arcyqwerty
- 10,325
- 4
- 47
- 84