Pinkie
Pinkie

Reputation: 10246

jQuery UI Tabs run function when tabs is clicked

I'm using jQuery UI tabs widget. How do we run a function when a tab is clicked on. I can't find any built in event that handles this.

Upvotes: 2

Views: 3067

Answers (2)

Michael Haren
Michael Haren

Reputation: 108236

From the docs:

tabsselect This event is triggered when clicking a tab.

// Supply a callback function to handle the select event as an init option.
$( ".selector" ).tabs({
   select: function(event, ui) { ... }
});

// Bind to the select event by type: tabsselect.
$( ".selector" ).bind( "tabsselect", function(event, ui) {
  ...
});

Note: if you want to run a function after the tab has loaded (especially if it's a remote tab), you probably want the load/tabsload event instead.

Upvotes: 2

user342706
user342706

Reputation:

Here is the documentation from jquery UI

$( ".selector" ).bind( "tabsselect", function(event, ui) {
  ...
});

Link

Upvotes: 2

Related Questions