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
  • 405,095
  • 59
  • 585
  • 614
topless
  • 8,069
  • 11
  • 57
  • 86

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,538
  • 24
  • 120
  • 194
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
  • 983
  • 1
  • 7
  • 18