我有一个类似这样的 DOM 结构(由于过度拥挤,我不想显示其他 td):
<table>
<tr><td><input type="checkbox" name="checkbox1" class="rowSelectCheckbox"></td></input></tr>
<tr><td><input type="checkbox" name="checkbox2" class="rowSelectCheckbox"></td></input></tr>
<tr><td><input type="checkbox" name="checkbox3" class="rowSelectCheckbox"></td></input></tr>
<tr><td><input type="checkbox" name="checkbox4" class="rowSelectCheckbox"></td></input></tr>
</table>
<input type="checkbox" name="checkbox_select" id="lastCheckbox"></input>
我想要做的是设置最后一个具有 lastCheckbox id 的复选框来检查是否选中了任何其他复选框(任何具有 checkbox1、复选框 2 等 id 的复选框),否则如果所有其他复选框都未选中,也将最后一个复选框设置为未选中。