Is there a way to reload the selected tab I know there is the .load() function. But it wants a tab index and I don't seem to see a way to grab the selected tabs id.
Update: In jQuery 1.9, the selected
option is renamed to active
. See attomman's answer.
To get the currently selected index, use the tabs('option','selected')
function.
E.g, if you have a button #button
(and the #tabs
element is made into tabs) where you want to get the index, do the following:
$("#button").click(function() {
var current_index = $("#tabs").tabs("option","selected");
});
Here's a demo: http://jsfiddle.net/sVgAT/
var current_index = $("#tabs").tabs("option","selected");
$("#tabs").tabs('load',current_index);
And in jQuery 1.9 and later, you would do:
var current_index = $("#tabs").tabs("option","active");
$("#tabs").tabs('load',current_index);