replace color

native js solution

by Vitaliy T

JavaScript

var colorElem = document.querySelectorAll('.js_color_option input[type="radio"]');
for (var i = colorElem.length - 1; i >= 0; i--) {
    colorElem[i].onclick = function(){
        var atrr = this.getAttribute('value');
        var atrrPlace = document.querySelectorAll('.js_color_option_block__gen_label span');
        atrrPlace[0].innerHTML = atrr;
    }
};