Radio Input and DIV same level - how to make changes to div when radio is checked

<label for="licItem1" class="license-radio">
<input type="radio" id="licItem1" name="licItem[]" class="license-radio__input">
<span class="license-radio__custom">
<span class="license-radio__custom-inner"></span>
</span>
<div>
Single site license
<!-- <small class="license-radio__add-text">Price: 79$USD</small> -->
</div>
</label>

Labels Input and div are the same hierarchical level when the radio button is checked. I want to change the color of the div to
color: #F16334;

I tried this, but that didn’t worked:

.license-radio__input:checked + div {
  color: #F16334;
}

That was the adjacent sibling combinator. :wink:
Then try the general sibling combinator:

.license-radio__input:checked ~ div {
  color: #F16334;
}
1 Like

Yups, Thanks. Kudos!

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.