File size: 461 Bytes
7a28073
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);