Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript document get by attribute

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');
        }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #document #attribute
ADD COMMENT
Topic
Name
9+9 =