Programmatically change Jquery tab focus
Asked Answered
S

2

8

I'm using a pretty simple implementation of the JQuery Tabs UI element. There is a form in the first tab that I am trying to have load the second tab with the onsubmit event. In ActionScript, I could use:

tabBar.selectedIndex = n;

Where selectedIndex is the tab number that has focus. Is there a way to get this done in Jquery?

Skeptic answered 4/10, 2012 at 2:27 Comment(1)
$('ele').tabs('select', index) where index is the 0 based representation of the tabs from LTR.Executory
K
14

UPDATE Since jQuery UI 1.9

The select method has been deprecated in favor of just updating the active option.

You should replace all calls to the select method with calls to the option method to change the active option.

// Activate the third panel
$( "#tabs" ).tabs( "option", "active", 2 );
Kandykane answered 28/2, 2013 at 3:40 Comment(0)
E
4

Sorry about that. I was on my phone at the time, here you go ->

$('ele').tabs('select', index);

Where index is the 0 based representation of the tabs from LTR

Please see the above answer for jQuery UI 1.9+. My answer is only for jQuery UI 1.8 and lower.

Executory answered 4/10, 2012 at 16:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.