JavaScript pilih elemen dengan atribut
document.querySelectorAll('[attrname="value"]');
TC5550
document.querySelectorAll('[attrname="value"]');
document.querySelectorAll('[data-foo="value"]');
//find first element with "someAttr" attribute
document.querySelector('[someAttr]')
//find all elements with "someAttr" attribute
document.querySelectorAll('[someAttr]')
priceChange(price, prefix, key, id) {
if (prefix === '+' && parseInt(price) > 0) {
this.price_print = (parseInt(this.originalPrice) + parseInt(price)).toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
} else if (price !== null) {
this.price_print = parseInt(this.originalPrice).toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}
document.querySelectorAll('[id_attr="attr' + key + '"]').forEach(function (el) {
el.classList.remove('product__storage__item-active');
});
document.getElementById('value_option' + id).classList.add('product__storage__item-active');
}