window.onload = function() {
const $seat = document.querySelector('.container');
const $select = document.getElementById('select');
const $count = document.getElementById('count');
const $total = document.getElementById('total');
let countClick = 0;
$select.addEventListener('change', e => {
$total.innerHTML = `${countClick * e.target.value}`;
})
$seat.addEventListener('click', e => {
if (e.target.parentNode.className !== 'row') {
return false;
} else if (e.target.className == 'seat') {
e.target.classList.add('active');
countClick++;
} else {
e.target.classList.remove('active');
countClick--;
}
$count.innerHTML = `${countClick}`;
$total.innerHTML = `${countClick * e.target.value}`;
})
}