0๐
โ
The problem was simply because Iโm using a
querySelector
which only
returns the first element with matching selector.
Solution to this problem is to change from querySelector
to getElementsByClassName
and then loop through the length of elements with the matching class, and there apply the other class to the elements.
this.sections[1].value = 50
this.sections[0].value = 50
if(this.sections[0].value = 50) {
this.sections[0].color = "transparent"
this.sections[1].color = "transparent"
let grad = document.getElementsByClassName("cdc")
for(let i = 0; i < grad.length; i++) {
grad[i].classList.add("border-gradient")
}
}
Source:stackexchange.com