問題:
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