Opened 14 years ago

Closed 14 years ago

Last modified 10 years ago

#4354 closed feature (worksforme)

Add method for querying a tab's index position

Reported by: dmuir Owned by:
Priority: minor Milestone:
Component: ui.tabs Version: 1.7
Keywords: tabs, index Cc:
Blocked by: Blocking:


There's no easy way to get the currently selected tab's index, or the index of any tab for that matter. Because of this, it's a pain to use most of the index based tab methods: add, remove, enable, select, load, url.

Adding a method for querying the position would make it a lot easier to utilise the afore mentioned methods. By allowing a jquery selector to be given as the second parameter, the interface doesn't need to become overly complex either.

Example usage:

.tabs('position'); //returns the position of the currently selected tab
.tabs('position', '.ui-tabs-selected');   //same as above
.tabs('position', '[href="#myTab"]');     //using attribute selector
.tabs('position', '#tabWithId');          //using id selector
.tabs('position', ':contains("My Tab")'); //position of tab with text "My Tab"

This functionality could be expanded to work with all index based methods and provides a means by which #3171 can be solved.:

.tabs('disable', '#tabWtihId');
.tabs('select', ':contains("My Tab")');

Change History (2)

comment:1 Changed 14 years ago by klaus.hartl

Resolution: worksforme
Status: newclosed

comment:2 Changed 10 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.