【发布时间】:2017-07-08 12:08:50
【问题描述】:
在给定的示例中,我可以在点击 td 的复选框时选择/取消选择每一行,但是如何在点击 id="selectAll" 时选择/取消选择所有行
JS:
$(document).ready(function () {
$("input[type='checkbox']").change(function (e) {
if ($(this).is(":checked")) {
$(this).closest('tr').addClass("warning");
} else {
$(this).closest('tr').removeClass("warning");
}
});
});
【问题讨论】:
-
Select All Checkbox的可能重复
-
不需要两个函数。试试我的答案@Appy
标签: javascript jquery