Reputation: 8091
I use jquery tabs plugin, but can't figure out how to set the event when user switches between tabs.
Please help.
Upvotes: 0
Views: 980
Reputation: 14429
activate( event, ui )
Triggered after a tab has been activated (after animation completes). If the tabs were previously collapsed, ui.oldTab and ui.oldPanel will be empty jQuery objects. If the tabs are collapsing, ui.newTab and ui.newPanel will be empty jQuery objects.
$( ".selector" ).tabs({
activate: function( event, ui ) {}
});
Bind an event listener to the tabsactivate event:
$( ".selector" ).on( "tabsactivate", function( event, ui ) {} );
Upvotes: 1
Reputation: 337626
You're looking for the activate()
event.
$(".selector").tabs({
activate: function(event, ui) {
alert("You changed tabs");
// Or do something more constructive...
}
});
Upvotes: 5