0

I have the following fragment:

<div>
  <input type="radio" class="A">
  <input type="radio" class="B">
</div>
<div class="A"></div>
<div class="B"></div>

I would like to select a div, who is following a div containing a checked radio button having the same class.

If I understand level 4 selectors correctly, this might do the job:

div:has(>input[type="radio"].A:checked) ~ div.A,
div:has(>input[type="radio"].B:checked) ~ div.B

But my browser does not support the :has pseudo class.

Is it possible to work around this without level 4 support?

ceving
  • 21,900
  • 13
  • 104
  • 178

0 Answers0