I have a unique bar with one half red and the other green. I am trying to subtract 1vw from the width of the red section.
Unfortunately, using style.width
is not yielding the desired result.
See below for the code snippet I am currently using:
//FIGHT
document.addEventListener("keydown", battle)
function battle(event){
console.log(event.code)
document.getElementById("ClickRed").style.width -= "1vw"
}