22-问题
10.5.1 问题
你需要用一个切换开关(这里是另一个复选框)选中和反选所有复选框。此外,如果单独选中某些(或者所有)复选框,切换动作应该自动变换它们的状态:
<fieldset>
<legend>Reasons to be happy</legend>
<input name="reasons" id="toggleAllReasons" type="checkbox" class="toggle" />
<label for="toggleAllReasons" class="toggle">Select All</label>
<input name="reasons" id="iwokeup" type="checkbox" value="iwokeup" />
<label for="iwokeup">I woke up</label>
<input name="reasons" id="health" type="checkbox" value="health" />
<label for="health">My health</label>
<input name="reasons" id="family" type="checkbox" value="family" />
<label for="family">My family</label>
<input name="reasons" id="sunshine" type="checkbox" value="sunshine" />
<label for="sunshine">The sun is shining</label>
</fieldset>