3

I have a list of elements in my page which are ordered with tabindex. What I am looking for is how can I emulate that the tab key was pressed so the focus to move on the next element? I am planning to change focus on my elements in a specific time interval i.e. 1sec by using jquery.

Pointy
  • 389,373
  • 58
  • 564
  • 602
topless
  • 7,829
  • 11
  • 56
  • 85

2 Answers2

1

Try this:

$('a[href="#your_tab"]').trigger('click')

Edit: I see you are trying to simulate TAB keypress not click mouseclick. This will help you I think: Simulating a tab keypress using JavaScript

Community
  • 1
  • 1
Ropstah
  • 17,178
  • 23
  • 117
  • 187
1

You could use Ropstah example but trigger the keypress event http://api.jquery.com/trigger/. You can specify which keycode you want "pressed"

Alistair Laing
  • 985
  • 1
  • 7
  • 18