Solution - creating an URL link for a specific tab

@Gail_Ranger Thank you for your response. How so? Any guidance to get closer to solving this would be highly appreciated. Thanks!

Edit: For those who have spaces and tab titles with multiple words, this is what I did to replace it with a dash so that the linking still works with the correct parameter. Hope this helps anyone that had the same issue as me:

<script>
$( function() {
    function changeTab() {
        var tabName = window.location.hash.substr(1);
        var tabTarget = $('[data-w-tab="' + tabName + '"]');
        if (tabTarget.length) {
            tabTarget.click();
        }
    }
    jQuery('[data-w-tab]').each(function(){
      var $this = $(this);
      var dataWTabValu = jQuery($this).attr('data-w-tab');
      var pargedDataTab = dataWTabValu.replace(/\s+/g,"-");
      jQuery($this).attr('data-w-tab', pargedDataTab);
    });

    //when page is first loaded
    if(window.location.hash){
        changeTab();
    }

    //internal page linking
    $(window).on('hashchange', changeTab);

    $('[data-w-tab]').on('click', function(){
        history.pushState({}, '', '#'+$(this).data("w-tab"));
    });
    
});
</script>
3 Likes