Problem in getting index for currently selected tab using option 'selected'
I am using the Tabs widget and already have it working in a <div> named 'navbar'.
Now I need to fetch the index of currently selected tab in one of the event handler functions.
According to the documentation for Tabs :
Get or set the selected
option, after init.
//getter
var selected = $( ".selector" ).tabs( "option", "selected" );
But instead of getting a number (index) in var 'selected', i am getting an object representing the current tab.
How do i obtain the index?
My code is as follows:
- var selected = $( '#navbar' ).tabs( "option", "selected" );
- if(selected==0){
- //do some thing based on selected tab index
- alert("in tab 0");
- }
- alert("loaded "+selected);