The span elements in this picture are from the mdn docs on how to hide an element using css only. It works as expected. Clicking showMe/hideMe does whats expected.
How come when I try to do the same when my radio element is checked, nothing happens? Here is the relevant code:
<!-- html -->
<div>
<input class="firstClass" type="radio" id="firstId">
<label for="firstId">Yes</label>
</div>
<div class="expandable">
<label for="secondId">Type of disability</label>
<input type="text" id="secondId">
</div>
/* css */
.expandable {
display: none;
}
.firstClass:checked ~ .expandable {
display: block;
}
Many thanks.