这是我的代码的JSFIDDLE 。
在这里,当复选框未选中时,我需要将背景颜色变为白色并隐藏单选按钮。
同时,当它被选中时,我想将背景颜色显示为当前颜色并显示单选按钮
<div class="newsletter-box">
<span class="bonus-credit-wrapper">
<input id="bonus-credit-checkbox" name="bonus-credit-checkbox" type="checkbox" value="" />
<label for="bonus-credit-checkbox" class="bonus-credit-checkbox-label">Your bonus credits</label>
<span class="bonus-credit-description">
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis
</span>
</span>
<span class="newsletter-preference">
<span class="newsletter-preference-text">I prefer for:
</span>
<span class="gender-radio">
<input checked id="newsletter-male" name="newsletter-gender" type="radio">
<label for="newsletter-male">Women</label>
</span>
<span class="gender-radio">
<input id="newsletter-female" name="newsletter-gender" type="radio">
<label for="newsletter-female">Men</label>
</span>
</span>