Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/478.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquerychecked属性始终返回false_Javascript_Jquery_Datatables - Fatal编程技术网

Javascript jquerychecked属性始终返回false

Javascript jquerychecked属性始终返回false,javascript,jquery,datatables,Javascript,Jquery,Datatables,已编辑,因为我仍然收到一个错误: 我有一个文本框,它动态添加到外部javascript文件中的Jquery数据表中 “checked”属性始终返回undefined,即使它默认为选中 $('#Table tbody tr')。每个(函数(){ log($(this.children().eq(5.html(),$(this.children().eq(5.prop)('checked')); }); $(this).children().eq(5)是,它没有选中属性。您需要从其中的获取属性

已编辑,因为我仍然收到一个错误:

我有一个文本框,它动态添加到外部javascript文件中的Jquery数据表中

“checked”属性始终返回undefined,即使它默认为选中

$('#Table tbody tr')。每个(函数(){
log($(this.children().eq(5.html(),$(this.children().eq(5.prop)('checked'));
});

$(this).children().eq(5)
,它没有选中
属性。您需要从其中的
获取属性

$(this).children().eq(5).children(":checkbox").prop("checked")
$(this).children().eq(5)
,它没有选中
属性。您需要从其中的
获取属性

$(this).children().eq(5).children(":checkbox").prop("checked")

这段代码不会总是将复选框设置回其原始状态吗?当您检查它时,它返回checked为true,然后设置为false。所以它永远不会被检查,对吗?@tymeJV是的,这是正确的。当OP进入click处理程序时,该值已经更改,他们立即将其设置回原始值我猜@tymeJV试图说的是:这不是必需的:
$(this).prop('checked',!$(this.prop('checked'))该代码不总是将复选框设置回其原始状态吗?当您检查它时,它返回checked为true,然后设置为false。所以它永远不会被检查,对吗?@tymeJV是的,这是正确的。当OP进入click处理程序时,该值已经更改,他们立即将其设置回原始值我猜@tymeJV试图说的是:这不是必需的:
$(this).prop('checked',!$(this.prop('checked'))