javascript - Ask for advice on jQuery judgment logic?
阿神
阿神 2017-05-19 10:15:03
0
3
474

How to determine that the checkboxes under all other brother elements of the clicked tr are checked?
Please give me some advice!!!

阿神
阿神

闭关修行中......

reply all(3)
过去多啦不再A梦
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');
}
我想大声告诉你

By querying parent-tr-siblings and then using for to judge

洪涛

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!