你好我试图检查所有复选框在我的表中的每个row
当我Dropdown menu
值Sent
和Status Column
的值等于Sent
。我现在可以选中/取消选中我桌子上的所有复选框。但现在我需要检查所有这些状态是Sent
,当下拉菜单也是Sent
。我赞赏所有答案。请检查我的代码如下。非常感谢如何检查具有相同值的所有复选框,从另一列
view.html
<thead>
<tr>
<td><strong><input type="checkbox" id="checkAll">Check All</strong></td>
<td><strong>Status</strong></td>
</tr>
</thead>
<tbody> <tr>
<td><input type="checkbox"/></td>
<td value="Sent">Sent</td>
</tr>
<tr>
<td><input type="checkbox" /></td>
<td value="Created">Created</td>
</tr>
<tr>
<td><input type="checkbox"/></td>
<td value="Created">Created</td>
</tr>
<tr>
<td><input type="checkbox" /></td>
<td value="Sent">Sent</td>
</tr>
<tr>
<td><input type="checkbox" /></td>
<td value="Sent">Sent</td>
</tr> </tbody>
<select class="form-control" id="default-select">
<option value="delete">Created</option>
<option value="stored">Stored Status</option>
<option value="sent">Sent Status</option>
</select>
的script.js
$("#checkAll").click(function(){
if($('#default-select option:selected').val() == 'sent'){
$('#testTable tbody input[type="checkbox"]').prop('checked', this.checked);
}});
尝试更换'this.checked'用'$(本)。是( “:勾选”)' – diavolic