function counter2(){
var counter =10;
var on=document.getElementById("bet");
setInterval(function(){
counter--;
if(counter==9){
on.innerHTML = "";
}
if(counter>=0){
id=document.getElementById("res");
var bet=document.getElementById("pts");
var beth=document.getElementById("beth");
var betv=document.getElementById("betv");
id.innerHTML="Bet within " +counter + " seconds";;
beth.disabled = false; //Beth is both Function and button //
beth.style.backgroundColor = "#4CAF50";
betv.disabled = false;
betv.style.backgroundColor = "#008CBA";
beth.style.cursor = 'pointer';
betv.style.cursor = 'pointer';
}
if(counter==0){
counter1();
}
}, 1000);
}
I am making a function where a button will be disabled after clicked but the above counter automatically enables the buttons but i want both of them to be executed i. E. Disable a button after clicked and also disable if the timer is going on and also to enable the buttons if the button is not clicked