.prev('.nav-tabs').find('.nav-link.active').attr('data-tab-name');
        var url = new URL(window.location.href);

        if (parentTabPane) {
            url.searchParams.set('tab', parentTabPane);
            url.searchParams.set('nested-tab', tabName);
        } else {
            url.searchParams.set('tab', tabName);
            url.searchParams.delete('nested-tab');
        }

        url.searchParams.delete('anchor'); // Remove anchor parameter when switching tabs
        history.replaceState(null,