Programmatically change Jquery tab focus

smulholland2 picture smulholland2 · Oct 4, 2012 · Viewed 16.5k times · Source

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?

Answer

Etienne Desgagné picture Etienne Desgagné · Feb 28, 2013

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 );