const links = document.querySelectorAll('.link');
document.querySelector('.wrapper').onclick = event => {
const btn = event.target.closest('button');
if (btn) {
[...links].forEach(link => {
const text = link.getAttribute('src').split('/');
text[text.length - 1 - +btn.parentNode.dataset.value] = btn.className;
link.src = text.join('/');
console.log(link.src);
})
}
}
<div class="selectboxssvalue"><span>Выбрать :</span></div>
<ul class="selectboxssmenu" data-value="2">
<li class="selectoption border-alcantara">one</li>
<li class="selectoption border-jakard" >two</li>
<li class="selectoption border-tkanN">three</li>
<li class="selectoption border-tkanT">four</li>
</ul>
</div>
const link = document.querySelector('.link');
document.querySelector('.wrapper').onclick = event => {
const btn = event.target.closest('button');
if (btn) {
const text = link.src.split('/');
text[text.length - 1 - +btn.parentNode.dataset.value] = btn.className;
link.src = text.join('/');
console.log(link.src);
}
}