Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI tabs: get current tab index

I want to get the index of the current tab using jQuery UI tabs: especially when the show or select events are fired i want to know the tab thay are referred is this possible?

like image 950
Matteo Pagliazzi Avatar asked Nov 05 '11 14:11

Matteo Pagliazzi


People also ask

How do I find the current tab index?

If you want to know tabindex of current element in HTML, then you should use document. activeElement. tabIndex .

How do I know which tab is clicked in JQuery?

try: $('#tabs'). on("click", "a", function - instead.


1 Answers

You can use this to find

var $tabs = $('#tab').tabs();
var selected = $tabs.tabs('option', 'selected');

From JQuery 1.9 on

var $tabs = $('#tab').tabs();
var selected = $tabs.tabs('option', 'active');
like image 135
YogeshWaran Avatar answered Oct 20 '22 18:10

YogeshWaran