title: jQuery UI Tabs - How to Get Currently Selected Tab Index
body: <p>I know this specific question has been <a href="https://stackoverflow.com/questions/185235/jquery-tabs-getting-newly-selected-index">asked before</a>, but I am not getting any results using the <code>bind()</code> event on the <code>jQuery UI Tabs</code> plugin. </p>
  
  <p>I just need the <code>index</code> of the newly selected tab to perform an action when the tab is clicked. <code>bind()</code> allows me to hook into the select event, but my usual method of getting the currently selected tab does not work. It returns the previously selected tab index, not the new one:</p>
  
  <pre><code>var selectedTab = $("#TabList").tabs().data("selected.tabs");
  </code></pre>
  
  <p>Here is the code I am attempting to use to get the currently selected tab:</p>
  
  <pre><code>$("#TabList").bind("tabsselect", function(event, ui) {
  
  });
  </code></pre>
  
  <p><strong>When I use this code, the ui object comes back <code>undefined</code></strong>. From the documentation, this should be the object I'm using to hook into the newly selected index using ui.tab. I have tried this on the initial <code>tabs()</code> call and also on its own. Am I doing something wrong here?</p>