
Hi,
for my sheet I want to add an option for the players to add containers for their characters in case they need them to store equipment. The players can activate up to 5 extra containers. With checkboxes they can activate/deactivate them. Now I'm currently trying to add the CSS to the checkboxes to toggle the visiblity of the div, but it doesn't work.
HTML:
<div>
<input type="checkbox" class="behaelter1" name="attr_behaelter1" value='1'><b>Behälter 1</b>
<input type="checkbox" class="behaelter2" name="attr_behaelter2" value='1'><b>Behälter 2</b>
<input type="checkbox" class="behaelter3" name="attr_behaelter3" value='1'><b>Behälter 3</b>
<input type="checkbox" class="behaelter4" name="attr_behaelter4" value='1'><b>Behälter 4</b>
<input type="checkbox" class="behaelter5" name="attr_behaelter5" value='1'><b>Behälter 5</b>
</div>
...
<div class="behaelter1">
....
</div>
CSS:
div.sheet-behaelter1 {
display: none;
}
input.sheet-behaelter1:checked ~ div.sheet-behaelter1 {
display: block;
}
I also tried to make the "path" of the input clearer with
div + input.sheet-behaelter1:checked ~ div.sheet-behaelter1 {
but that also didn't work. The div indeed gets the display:none but the click on the checkbox does nothing.
What is the error here?