0

From a purely CSS standpoint I'm trying to find a way to hide/show an element based on a radio button being marked. I think the issue I'm having is that I'm trying to grab from sibling. Is there a way to grab the parent's sibling?

.radio > input#yes_0:checked~.something {
  display: inherit;
}
.something {
  display:none;
}
<form>
  <div class="row form-group radio">
    <input class="form-check-input" type="radio" value="0" name="radio" id="yes_0">
    <label class="form-check-label" for="radio_Yes">Yes</label>
    <input class="form-check-input" type="radio" value="1" checked="checked" name="radio" id="no_1">
    <label class="form-check-label" for="radio_no">No</label>
  </div>
  <div class="something">
    <h4>Something</h4>
  </div>
</form>
Jake
  • 1,328
  • 1
  • 21
  • 51

0 Answers0