I've been attempting to create a switch that, when clicked, toggles between "ski" and "snowboard."
My JavaScript code seems like it should work, but for some reason, nothing is happening.
function toggleDisplay(a,b){
document.getElementById(a).style.display = "none";
document.getElementById(b).style.display = "";
}
.switch {
border: 1px solid black;
background-color: rgb(220,220,220);
padding: 2px;
width:150px;
height:24px;
}
#on {
float:left;
display:"";
width: auto;
height:20px;
background-color: rgb(95,170,250);
}
#off {
float:right;
display:none;
width: auto;
height:20px;
background-color: rgb(250,50,25);
}
<div class="switch">
<div id="on" onclick="toggleDisplay('on','off')">
Ski
</div>
<div id="off" onclick="toggleDisplay('off','on')">
Snowboard
</div>
</div>