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="deleteRow(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)
Expand|Select|Wrap|Line Numbers
- i = currentID;
- while(i < ElementsCounter){
- newID = i - 1;
- $("delete"+i).id = "delete"+newID;
- $("delete"+newID).onclick = function(){ deleteRow(newID); };
- }