Current Tab

Is there a way to capture the currently selected tab of a tab panel? For instance, can I determine what tab the user is currently viewing? Is this information I can capture and use within a method?

There is a property ‘tabIndex’ which represents the current tab
example:
-elements.tabpanelName.tabIndex = 2 //shows second tab
-var currentTab = elements.tabpanelName.tabIndex;//gets the selected tab