I'm having some trouble trying to change a property on the <a>
tag when the first radio button is checked. It works fine when I want to change a <label>
property when one is checked but not with the <a>
Can anyone help me out?
I'm having some trouble trying to change a property on the <a>
tag when the first radio button is checked. It works fine when I want to change a <label>
property when one is checked but not with the <a>
Can anyone help me out?
The
+
selector means there must not be any other elements coming between the two elements. The reason+ label
works is because yourlabel
comes immediately after your radio button. However, thatlabel
is standing between your radio button and thediv
, so#radio-one:checked + div
won't work.You need to use
Updated fiddle
Also see this answer for an illustration on how the
+
selector works.