How to get currently selected tab index in jquery UI?
14,767
You need to use it this way. ui
does not have any property called index
alert(ui.newTab.index());
- Get the index of currently selected tab:
ui.newTab.index()
- Get the index of last selected tab:
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.
Author by
omega
Updated on June 05, 2022Comments
-
omega almost 2 years
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
-
Harry over 9 yearsam getting TypeError: ui.newTab.index() is undefined
-
Full Stack Developer - Java almost 8 yearsHow to get index of sub-tab ?