[Vuejs]-How to set a gradient color for the "border" when its at 100% by Vue โ€“ Custom css package

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")
   }     
}

Leave a comment