views:

98

answers:

1

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.

A: 

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/


To answer the question indicated by the title, you would do:

var current_index = $("#tabs").tabs("option","selected");
$("#tabs").tabs('load',current_index);
Simen Echholt
Thanks, that was exactly what I was looking for.
Arimil