$select.forEach(item => {
item.addEventListener('click', function () {
$select.filter(i => i !== item).each(i => i.classList.remove('_select--opened'));
this.classList.toggle('_select--opened');
});
});
UPD
$select.forEach(item => {
item.addEventListener('click', function () {
- $select.filter(i => i !== item).each(i => i.classList.remove('_select--opened'));
+ Aray.from($select).filter(i => i !== item).forEach(i => i.classList.remove('_select--opened'));
this.classList.toggle('_select--opened');
});
})