I’m using jQuery UI tabs for product pages on my website. On some pages I have 2 tabs and on some 3. I would like to open last tab from a text link. The jquery tabs api just shows you how to go a particular tab if you know the tab index(let’s say 2 to open 3rd tab). I tried the code below but it didn’t help. Please advise. Thanks.
$("#productTabs").tabs();
var $tabs = $('#productTabs').tabs(); // first tab selected
$("a[href$='mylink']").click(function(event){
$tabs.tabs('select', -1); // switch to last tab
return false;
});
Basically get the length of the tab group and subtract one to get the last index value.