I have a hidden button i want to show when the user has 5 coffee this is my code but it just doesn't seem to work
JS
window.setInterval(function(){
if (coffee == 5) {
document.getElementById("U1").style.visibility = "visible";
console.log()
}
}, 500);
HTML
<button class="U1" onclick="SuperPlant()"> Super Beans</button><br>
CSS
.U1 {
visibility: hidden;
}
ERROR IN CONSOLE
TypeError: null is not an object (evaluating 'document.getElementById("U1").style')
classbut selecting the element using id method so either you need to declare an id to the button or you need to usegetElementsByClassName()