简体   繁体   English

如何更新checbox为复选框的行-jQuery

[英]How to update a row where checbox is checkbox is ticked - jquery

I want to update certain rows where checkboxes are ticked. 我想更新选中​​复选框的某些行。 I am able to get the rows every cells content but not able to update them. 我能够获取每个单元格内容的行,但无法更新它们。

I'm trying to update 7th cell's content like this: 我正在尝试像这样更新第7个单元格的内容:

$.each($("input[name='eachSelector']:checked").parents("tr"), function () {
    $(this).find('td:eq(7)').innerText = "this is modified";
});

I am able to get all the cells values of the checked rows like this below values is an array. 我能够得到像这样的检查行的所有单元格值,下面的值是一个数组。

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

how to update the cells values and add some css to it 如何更新单元格值并向其中添加一些CSS

You have an error in your code. 您的代码中有错误。 You are trying to use a DOM method on a jquery object. 您正在尝试在jquery对象上使用DOM方法。 You should change this line 您应该更改此行

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

to

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM