Deep Linking to Elementor Nested Tabs Using URL Hash ( automatically open tab when button click )
Purpose
This SOP explains how to create custom links (buttons, menu items, or external URLs) that automatically scroll to and open a specific Elementor Nested Tab (e.g., “Chat Platforms”) when a page loads.
Step 1: Assign a Unique CSS ID to the Tab
-
Open the page in Elementor Editor
-
Click the Nested Tabs widget
-
Select the tab you want to deep-link (example: “Chat Platforms”)
-
Set CSS ID to:
-
Update the page
⚠️ Ensure this ID is unique and not used elsewhere on the page.
Step 2: Create the Deep Link URL
Use this format:
This link can be used in:
Step 3: Add JavaScript Using Elementor Custom Code
Why this is required
Elementor Nested Tabs load after the page DOM.
Custom Code runs after Elementor frontend initialization, ensuring the tab can be activated correctly.
How to Add Custom Code
-
Go to WordPress Dashboard
-
Navigate to Elementor → Custom Code
-
Click Add New
-
Enter:
-
Name:
Nested Tabs Deep Linking -
Location:
Body End
-
-
Set Display Conditions:
-
Entire Site OR
-
Specific Page (recommended)
-
<script>
(function () {
function openNestedTab() {
if (!window.location.hash) return;
const id = window.location.hash.substring(1);
const tab = document.getElementById(id);
if (!tab || !tab.classList.contains('e-n-tab-title')) return;
const tabs = tab.closest('.e-n-tabs');
if (!tabs) return;
const index = tab.dataset.tabIndex;
tabs.querySelectorAll('.e-n-tab-title').forEach(b => {
b.setAttribute('aria-selected', 'false');
b.classList.remove('e-active');
b.tabIndex = -1;
});
tabs.querySelectorAll('[role="tabpanel"]').forEach(p => {
p.classList.remove('e-active');
p.hidden = true;
});
tab.setAttribute('aria-selected', 'true');
tab.classList.add('e-active');
tab.tabIndex = 0;
const panel = tabs.querySelector(
`[role="tabpanel"][data-tab-index="${index}"]`
);
if (panel) {
panel.hidden = false;
panel.classList.add('e-active');
}
tabs.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
window.addEventListener('load', () => {
setTimeout(openNestedTab, 800);
});
})();
</script>
Step 4: Testing Procedure
-
Clear site cache (important)
-
Open an incognito/private browser
-
Visit:
-
Confirm:
-
Page scrolls to the Tabs section
-
“Chat Platforms” tab opens automatically
-
Content inside the tab is visible
-
No comments to display
No comments to display