Auto click tab by id name using javascript? Editor X

Hello! I’m trying to auto click tab after page loaded

full code:

import wixLocationFrontend from 'wix-location-frontend';
$w.onReady(function () {
$w('#singleTab74').click();
});

but doesn’t work
any idea?

Pretty sure you’re supposed to use changeTab() to change the tab

1 Like

Thank you Simen! that’s helpful
just to share the solution:
in my case I want to auto click on specific tab based on url parameter,
$url.com/work?tab=brand-identity
so I’m using

// get full url
let url = wixLocationFrontend.query;
// assigned tab, you can find out via Editor X Dev Mode
let workTab = $w('#tabs5');
// now check url.tab and change it based on tab parameter value
if(url.tab == 'brand-identity'){ 
workTab.changeTab('singleTab73')
}
else if(url.tab == 'packaging-design'){ 
workTab.changeTab('singleTab72') 
}

Hopes that’s helping
Thankns, Mazin