Select a jQuery UI tab by link

jQuery

It will often be the case that you will need to trigger a jQuery UI tab from a bespoke link.

This can be done using following the formats listed below: 

Code

//Latest jQuery UI

$(selector).tabs('option', 'active' ,0);

//Older jQuery UI 

$(selector).tabs('select',0);

// Example

<button type="button" class="btn btn-default" data-tab="0">Tab 1</button>

$('[data-tab]').click(function(){

        var tabId = $(this).data('tab');

        //alert(tabId);

        jQueryTabs.tabs('option', 'active', tabId);

        //jQueryTabs.tabs('"select', tabId);  //older version of jQuiry UI

        return false;

});