gpt4 book ai didi

javascript - 获取表中带有复选框的行

转载 作者:行者123 更新时间:2023-11-28 13:41:37 25 4
gpt4 key购买 nike

所以我试图找到带有复选框的行,然后从该行获取列值。这是我到目前为止所拥有的:

$('#myTable tbody tr').each(function () {
var chckbox = $(this).find('.checkItem');
if (chckbox.checked) {
ids.push($(this).find(".id").html());
}
});

现在的问题是它永远不会进入 if 语句。类名都是正确的。

最佳答案

$('#myTable tbody tr').each(function () {
var chckbox = $(this).find('.checkItem');
if (chckbox.prop('checked')) {
ids.push($(this).find(".id").html());
}
});

jQuery .prop

关于javascript - 获取表中带有复选框的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17506468/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com