[英]How to update a row where checbox is checkbox is ticked - jquery
我想更新选中复选框的某些行。 我能够获取每个单元格内容的行,但无法更新它们。
我正在尝试像这样更新第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";
至
$(this).find('td:eq(7)').text("this is modified");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.