2022-07-25

How to change an objects properties right after a condition is met?

I am trying to make a button go from .disabled = true to .disabled = false. I am making a Yahtzee clone for fun, and you have to choose a score to take on your third roll, and then after that the button will be unlocked and you can roll again. Here's what I had, but it crashes. I wanted to make a while statement until a score is selected. ptsss is the amount of scores that have been selected. (i.e. third roll should equal 1 score entered)

if(rollcount == 3){
      while (ptsss * 3 < rollcount){
         document.getElementById("rollbutton").disabled = true;
         if (ptsss * 3 == rollcount){
            document.getElementById("rollbutton").disabled = false;
            break;
         }
      }
    }
    }


No comments:

Post a Comment