sigit_design/assets/js/premiumTogglePackages.js

20 lines
941 B
JavaScript

document.querySelectorAll('.secMBSI_DSMPremiumSecMidSubscribeBoxSecCheckbox').forEach(radio => {
radio.addEventListener('change', () => {
document.querySelectorAll('.secMBSI_DSMPremiumSecMidSubscribeBoxSecCheckbox').forEach(otherRadio => {
const parentDiv = otherRadio.closest('div');
if (otherRadio.checked) {
parentDiv.classList.add('secMBSI_DSMPremiumSecMidSubscribeBoxSecCheckboxWrapperActive');
} else {
parentDiv.classList.remove('secMBSI_DSMPremiumSecMidSubscribeBoxSecCheckboxWrapperActive');
}
});
});
// Initial check in case any radio is already checked
if (radio.checked) {
radio.closest('div').classList.add('secMBSI_DSMPremiumSecMidSubscribeBoxSecCheckboxWrapperActive');
} else {
radio.closest('div').classList.remove('secMBSI_DSMPremiumSecMidSubscribeBoxSecCheckboxWrapperActive');
}
});