How to determine that the checkboxes under all other brother elements of the clicked tr are checked?
Please give me some advice!!!
过去多啦不再A梦2017-05-19 10:17:03
var flag = false;
$("tr").siblings().each(function () { // 所有兄弟节点
$(this).find("checkbox").each(function () { // 兄弟节点下面的所有checkbox // 如果只有一个的话直接写不用遍历了
if (this.checked === false) {
flag = true;
console.log('不是所有的checked都为true');
}
})
})
if (!flag) {
console.log('所有的checked都为true');
}
PHP中文网2017-05-19 10:17:03
Get all tr, maintain an array, click to change the corresponding index status of the array, traverse the array to determine which ones are currently checked