I want a button to stay gray if a difficulty was not chosen. Once it is chosen, the button should become a different color. I want a the .hover to apply to the button all the time. This is my current non-working code:
<div id="start">
<p id="startText" class="text">Find random exercise!</p>
</div>
<style>
#start{/*styling for the button and the text inside as well as .hover*/
width: 50%;
height: 100px;
background-color: gray;
position: absolute;
top: 50%;
left: 24%;
}
#startText{
position: absolute;
top: 15%;
left: 14%;
}
#start:hover{
background-color: yellow;
}
</style>
<ul id="difficulty"><!--Here I have a ul with the difficulties to select
<li id="easy" class="list" onclick="shadows(1)">Easy</li>
<li id="medium" class="list" onclick="shadows(2)">Medium</li>
<li id="hard" class="list" onclick="shadows(3)">Hard</li>
</ul>
Once the difficulty is clicked, the shadows() function runs. Here it is:
var start=document.getElementById("start");
function shadows(number){
start.style.cursor="pointer";
start.style.backgroundColor="#ffffb3"; //I change the color of the background
if(number==1){
chosenDifficulty=.5;
}
else if(number==2){
chosenDifficulty=1;
}
else{
chosenDifficulty=1.5;
}
}
How can I change the background color and not affect the hover?