Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.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 如何更新选中checbox复选框的行-jquery_Javascript_Jquery - Fatal编程技术网

Javascript 如何更新选中checbox复选框的行-jquery

Javascript 如何更新选中checbox复选框的行-jquery,javascript,jquery,Javascript,Jquery,我想更新勾选复选框的某些行。我能够获取每个单元格内容的行,但无法更新它们 我正在尝试更新第7单元的内容,如下所示: $.each($("input[name='eachSelector']:checked").parents("tr"), function () { $(this).find('td:eq(7)').innerText = "this is modified"; }); 我可以得到所有单元格中的选中行的值,如下所示:值是一个数组 $.each($("input[name

我想更新勾选复选框的某些行。我能够获取每个单元格内容的行,但无法更新它们

我正在尝试更新第7单元的内容,如下所示:

$.each($("input[name='eachSelector']:checked").parents("tr"), function () {
    $(this).find('td:eq(7)').innerText = "this is modified";
});
我可以得到所有单元格中的选中行的值,如下所示:值是一个数组

$.each($("input[name='eachSelector']:checked").parents("td").siblings("td"), function () {
    values.push($(this).text());
});

如何更新单元格值并向其中添加一些css

您的代码中有一个错误。您正试图在jquery对象上使用DOM方法。你应该换一行

$(this).find('td:eq(7)').innerText = "this is modified";


你试过.text而不是.innerText吗?是的,不起作用。你能试一下$(this.find('td:eq(7)')).html(“this is modified”);如何将css添加到同一行它工作了,请告诉我如何将css添加到它?这解决了您最初的问题吗?要直接添加css,可以执行
$(this).find('td:eq(7)').css(“背景”,“红色”),或者您可以执行
$(this).find('td:eq(7)').addClass(“红色bg”)如果定义了
.red bg
类。
$(this).find('td:eq(7)').text("this is modified");