const tabs = document.querySelectorAll('.tabs input[type="radio"]'); const tabContents = document.querySelectorAll('.tab-content'); const tabLabels = document.querySelectorAll('.tabs label'); // Assuming you have labels function showTab(tabIndex) { tabContents.forEach(content => { content.classList.remove('active'); }); tabLabels.forEach(label => { label.classList.remove('active'); // Remove 'active' from all labels }); tabs[tabIndex].checked = true; tabContents[tabIndex].classList.add('active'); tabLabels[tabIndex].classList.add('active'); // Add 'active' to the clicked label } tabs.forEach((tab, index) => { tab.addEventListener('click', () => { showTab(index); }); }); // Show initial tab showTab(0);