TCTF / scripts.js
mvaloatto's picture
Create scripts.js
7a28073 verified
raw
history blame
461 Bytes
const tabs = document.querySelectorAll('.tabs input[type="radio"]');
const tabContents = document.querySelectorAll('.tab-content');
function showTab(tabIndex) {
tabContents.forEach(content => {
content.classList.remove('active');
});
tabs[tabIndex].checked = true;
tabContents[tabIndex].classList.add('active');
}
tabs.forEach((tab, index) => {
tab.addEventListener('click', () => {
showTab(index);
});
});
// Show initial tab
showTab(0);