I have a pagination html table with checkboxes. I want to be able to select few rows or all rows in the 1st page and change the value of a column in that particular row/or all rows.


  myFunction:function () {
            var table = document.getElementById("myTable");
            for (var i = 1, row; row = table.rows[i]; i++) {
                table.rows[i].cells[6].innerHTML = 'Yes';

I tried this,it worked and I am trying to do this with multiple/all rows but not working when I select few rows.  Please help me with both - few/all rows. 

1 Answer 1


You are incrementing your list variable three times:

for (var i = 0; i < allRecords.length; i++) { // Increment once
    if(allRecords[i].isChecked ){
        selectedRecords.push(allRecords[i++].objAccount.id); // Increment again
        myTable.rows[i++].cells[6].innerHTML = 'yes'; // Increment again

This will result in a variety of surprising behaviors, including skipped records and incorrect data in myTable. You should simply be referencing i.

  • Hey David, yes you are right so i edited my code its working fine when i select all rows in the 1st page.What can i do to achieve both , i want to select few rows and change the value too .can you help with that. Thank you.
    – koli
    Aug 17, 2020 at 4:48
  • You've changed your question in a way that makes my answer no longer make sense - please don't do that; it destroys the value for any other reader. To change your data, you would have to write to whatever the underlying data store is, probably allRecords.
    – David Reed
    Aug 17, 2020 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .