TCTF / scripts.js
mvaloatto's picture
Upload 13 files
305b068 verified
raw
history blame
No virus
750 Bytes
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);