I am trying to create a switch list of styles, but I am not really using the input type = radio. My third-party developer advised me to create this using type = "checkbox" in our particular case. I believe this can be done with JS. So, how can I make it so that when 1 parameter is in check state, the other is not set using JS? Here is what I still have:
http://codepen.io/rjtkoh/pen/VLZrMo
<label for="toggle-1">
<input type="checkbox" id="toggle-1">
<div>option A</div>
</label>
<label for="toggle-2">
<input type="checkbox" id="toggle-2">
<div>option B</div>
</label>
and CSS:
input[type=checkbox] {
position: absolute;
top: -9999px;
left: -9999px;
}
div {
background: green;
width: 400px;
height: 100px;
line-height: 100px;
color: white;
text-align: center;
margin-bottom: 20px;
}
input[type=checkbox]:checked ~ div {
background: red;
}
I looked at other topics about changing pseudo classes through JS, but my input type business is confusing to me.
source
share