let flagBox = document.querySelector('.js-do-flag')
if (flagBox) {
    flagBox.querySelectorAll('select option').forEach(item => {
        if (item.selected) {
            let selectedFlag = item.getAttribute('data-flag');
            flagBox.querySelector(`.flag img.${selectedFlag}`).classList.remove('d-none')
        }
        item.addEventListener('click', function () {
            flagBox.querySelectorAll('.flag img').forEach(delActive => {
                delActive.classList.add('d-none')
            })
            if (item.selected) {
                let selectedFlag = item.getAttribute('data-flag');
                console.log(selectedFlag);
                
                flagBox.querySelector(`.flag img.${selectedFlag}`).classList.remove('d-none')
            }
        })
    })
}
