Hi I want to perform a task when I click a specific tab, let's say #tab-2. how is that done? I don't understand the documentation on the jquery site.
I know how it's done on all tabs but not just one
Hi I want to perform a task when I click a specific tab, let's say #tab-2. how is that done? I don't understand the documentation on the jquery site.
I know how it's done on all tabs but not just one
You can do it like this, just check the tab ID:
$( ".selector" ).tabs({
select: function(event, ui) {
if(ui.tab.href == "#tab-2") { // or ui.panel.id == "tab-2"
//do something...
}
}
});
You can see what all elements are available on the passed ui
argument here, ui.tab
is the selected tab link (the <a>
), ui.panel
is the selected tab itself (the <div>
).