[英]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.