I ran into a strange problem:
I'm adding and removing rows dynamicly,
each row has it's id and remove button
when I removing a row i go on all the next rows and update their ID
I also need to update the delete row button.
the problem is that the button has onclick="delete Row(rowId)"
and when I remove a row and update all the next elements
all of them are calling the deleteRow with the same ID (the id of last one)
any idea will help
I'm adding and removing rows dynamicly,
each row has it's id and remove button
when I removing a row i go on all the next rows and update their ID
I also need to update the delete row button.
the problem is that the button has onclick="delete Row(rowId)"
and when I remove a row and update all the next elements
all of them are calling the deleteRow with the same ID (the id of last one)
Code:
i = currentID; while(i < ElementsCounter){ newID = i - 1; $("delete"+i).id = "delete"+newID; $("delete"+newID).onclick = function(){ deleteRow(newID); }; }
Comment