dimanche 29 mars 2020

Why does the function not work when the bar value is zero

function function1() {
document.getElementById("progress1");
progress1.value -= 25
}

function gameOver() {
if (document.getElementById("progress1").getAttribute("value") === 0) {
alert("GameOver")
}else {
}
}

gameOver();
<button onclick="function1()" id="button1">Click Me !</button>
<progress id="progress1" value="50" max="100"></progress>

I want to run the gameOver function when the bar value is 0 but it doesn't respond

Aucun commentaire:

Enregistrer un commentaire