How to get currently selected tab index in jquery UI?-Collection of common programming errors

In jquery UI, using their newest version, I can’t get the ID of the selected tab anymore. I tried ui.index from jQuery UI Tabs Get Currently Selected Tab Index, but it gives me undefined.

Does anyone know the way to do this now?

$( "#tabs" ).bind( "tabsactivate", function(event, ui) { 
    alert(ui.index);
});

In this code, I get the alert every time I select a new tab, but its says undefined.

Thanks