I am currently making 5 buttons where after the user has pressed one of them, all get disabled. I have managed to do that, but I will also add a sign or colour of the selected button, but I can't get it to work. I have 5 of these buttons:
<button class="btn white black-text voteBtn" id="btn1" onclick=" disableButton();"> Button 1 </button>
and the javascript I use is:
function disableButton(){
var elems = document.getElementsByClassName("voteBtn");
for(var i = 0; i < elems.length; i++) {
elems[i].disabled = true;
};
};
I have tried using the toggle function to toggle an additional class and background colour from there, but I can't get it to work. Is there a way I can add a background colour to the selected button?