Reputation: 43833
In jquery UI, using their newest version, I can't get the ID of the selected tab anymore. I tried ui.index
from jQuery UI Tabs Get Currently Selected Tab Index, but it gives me undefined.
Does anyone know the way to do this now?
$( "#tabs" ).bind( "tabsactivate", function(event, ui) {
alert(ui.index);
});
In this code, I get the alert every time I select a new tab, but its says undefined.
Thanks
Upvotes: 2
Views: 15551
Reputation: 123739
You need to use it this way. ui
does not have any property called index
alert(ui.newTab.index());
ui.newTab.index()
ui.oldTab.index()
ui.newTab
will return you the jquery object representing the element and you can invoke the index()
method on it to get the index.
Upvotes: 15