我需要jQuery选择器的帮助.假设我有一个标记,如下所示:
<form>
<table>
<tr>
<td><input type="checkbox" id="select_all"/></td>
</tr>
<tr>
<td><input type="checkbox" name="select[]"/></td>
</tr>
<tr>
<td><input type="checkbox" name="select[]"/></td>
</tr>
<tr>
<td><input type="checkbox" name="select[]"/></td>
</tr>
</table>
</form>
Run Code Online (Sandbox Code Playgroud)
除了#select_all用户点击它之外,如何获取所有复选框?
任何帮助将不胜感激.
我有以下代码.它使用LABEL元素检查页面上的所有复选框,该元素通常位于复选框的顶部.现在我如何使用相同的LABEL元素取消选中所有框?
jQuery(document).ready(function($) {
var $checkBoxes = $('input[type="checkbox"]');
$('label').click(function() {
$checkBoxes.attr('checked', true);
});
});
Run Code Online (Sandbox Code Playgroud)