简体   繁体   中英

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:

$.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

You have an error in your code. You are trying to use a DOM method on a jquery object. You should change this line

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

to

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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