I\'m working on making a dynamic HTML table using jQuery. In a table, my user has two interactions:
The
After the user has appended a row, or deleted one, you just need to iterate over the "number" cells. If we assume that you have a 1) give them a nice ID, e.g. 2) write a function to iterate over them: element, we:
row_0
, row_1
, etc...function updateRows(){
$('[id*="row_"]').each(function(index){
$(this).html(index + 1); // add +1 to prevent 0 index.
};
};