document.addEventListener('DOMContentLoaded', function () { const tabs = document.querySelectorAll('.tabSectionMalware'); const tabDetails = document.querySelectorAll('.tabDetailsMainSection'); function handleTabClick(event, index) { tabs.forEach(tab => { tab.classList.remove('tabSectionActiveMalware'); }); tabDetails[0].children[0].classList.remove('tabSectionActiveDetails'); tabDetails[0].children[1].classList.remove('tabSectionActiveDetails'); tabDetails[0].children[2].classList.remove('tabSectionActiveDetails'); tabDetails[0].children[3].classList.remove('tabSectionActiveDetails'); tabDetails[0].children[4].classList.remove('tabSectionActiveDetails'); tabDetails[0].children[index].classList.add('tabSectionActiveDetails'); event.target.classList.add('tabSectionActiveMalware'); } tabs.forEach((tab, index) => { tab.addEventListener('click', function (event) { handleTabClick(event, index); }); }); }); var headers = document.querySelectorAll('.tabSectionHeader'); headers.forEach(function (header) { header.addEventListener('click', function () { var clickedParent = header.parentNode; headers.forEach(function (otherHeader) { var otherParent = otherHeader.parentNode; if (otherParent !== clickedParent) { otherParent.classList.remove('chartActiveOpenClose'); } }); clickedParent.classList.toggle('chartActiveOpenClose'); }); });