document.querySelector('[data-variant-id="2147671_3"]').getAttribute('data-price')
document.querySelector('.variant[data-variant-id="2147671_3"]').getAttribute('data-price')
document.querySelector('[data-variant-id]').getAttribute('data-price')
document.querySelector('.variant[data-variant-id]').getAttribute('data-price')
document.querySelectorAll('[data-variant-id]')[0].getAttribute('data-price')
document.querySelectorAll('.variant[data-variant-id]')[0].getAttribute('data-price')
let screen = document.querySelector('.screen');
let buttons = document.querySelectorAll('.btn');
let clear = document.querySelector('.btn-clear');
let equal = document.querySelector('.btn-equal');
let answer = '';
buttons.forEach( (button) => {
button.addEventListener('click', function (e) {
let value = e.target.dataset.num;
value !== undefined ? screen.value += value : false
})
});
clear.addEventListener('click', function (e) {
screen.value = '';
});
let result = () => {
try {
screen.value = eval(screen.value);
}
catch (err) {
alert('Enter the valid input');
}
}
.checkbox__label {
border: 1px #D2D0D0 solid;
border-radius: 14px;
padding: 4px;
}
let inputs = document.querySelectorAll('input[type="checkbox"]')
let labels = document.querySelectorAll('label')
for (let elem of inputs){
function checker(){
for (let el of labels){
if (elem.id == el.htmlFor){
elem.checked ? el.classList.add('checkbox__label') : el.classList.remove('checkbox__label')
}
}
}
elem.addEventListener('change', function(){
checker()
})
checker()
}
Можете заменить на то что имеется и всё будет работать