Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i check which tabs is active using jquery tabs?

how do i check which tabs is active using jquery tabs?

like image 265
Bart Avatar asked Oct 29 '10 03:10

Bart


People also ask

How do you check whether the tab is active or not in jQuery?

Try this instead: var ref_this = $("ul. tabs li a. active");


2 Answers

Please try with Index

 function getIndex(){
     return $("ul li.ui-state-active").index();
    }

It will returns the index of selected li or tab.

like image 116
kbvishnu Avatar answered Oct 06 '22 17:10

kbvishnu


I needed to get the active tab during the activate event. I was able to do this using the option active call.

$('#tabs').tabs({
    activate: function (event, ui) {
        var activeTabId = $(this).tabs('option', 'active');
    }
});
like image 34
Chris Porter Avatar answered Oct 06 '22 18:10

Chris Porter