问题:
How can I check if a checkbox in a checkbox array is checked using the id of the checkbox array?如何使用复选框数组的 id 检查复选框数组中的复选框是否被选中?
I am using the following code, but it always returns the count of checked checkboxes regardless of id.我正在使用以下代码,但它始终返回选中复选框的计数,而不管 id。
function isCheckedById(id) {
alert(id);
var checked = $("input[@id=" + id + "]:checked").length;
alert(checked);
if (checked == 0) {
return false;
} else {
return true;
}
}
解决方案:
参考一: https://stackoom.com/question/9FQQ参考二: Check if checkbox is checked with jQuery