How can i retrieve the index of the currently selected tab?

How can i retrieve the index of the currently selected tab?


i follow the Jquery UI documentation, use the following code to get
the index:
var $tabs = $('#example').tabs();
var selected = $tabs.tabs('option', 'selected');
but, when i alert(selected), it return the object, not return the
index of the selected tab?
why?
Thanks for your help!