Problem getting tab selected

Problem getting tab selected


Hallo all.
I'm trying to get the selected tab and as said in the how to i call
this piece of code:
var $tabs = $('#example').tabs();
var selected = $tabs.data('selected.tabs');
alert(selected);
But when I get the right selected tab I notice that the tab is
reloaded.
Is it correct? I would like to know which tab is selected, then make a
custom action based on this information.
Any idea?
Kind regards
Massimo Ugues