There are two checkbox
, it is necessary that when you click on the first, the second is turned off (or even others, for example). In this case, I work only in one direction. Because of the order of html. I mean, since the input
/ label
first one is higher, then it works, the second one does not react. JS I do not know, so I'm trying to collect a bike from the sticks.
Question: Is it possible to implement this via CSS or do I need to resort to scripts?
input, label { display: inline-block; } /* 1 > 2 */ #ch-areas:checked ~ .sh-islands { pointer-events: none; } #ch-areas:checked ~ .sh-islands .tx-islands { color: grey !important; } /* 2 > 1 */ #islands:checked ~ .sh-areas { pointer-events: none; } #ch-areas:checked ~ .sh-areas .tx-areas { color: grey !important; }
<input type="checkbox" class="show-areas checkbox" id="ch-areas" /> <label for="ch-areas" class="sh-areas"><span class="label-text tx-areas">1</span></label> <br> <input type="checkbox" class="show-islands checkbox" id="islands" /> <label for="islands" class="sh-islands"><span class="label-text tx-islands">2</span></label>