Reputation: 565
I have a dynamic table which has 2 dynamic rows .i.e students and their subjects and marks. The code is below :
Code for Serial Number
function numberRows() {
$('input[name^="SNo"]').each(function(i) {
$(this).val(i + 1);
});
}
numberRows();
Output that comes :
Output expected
The serial numbers are not generated dynamically. Where could I have possibly gone wrong? Would appreciate any help/ suggestions! :)
Upvotes: 0
Views: 1008
Reputation: 916
You are calling function
numberRows();
after return statement. Either update logic or call it at the after processing return call. Like - https://jsfiddle.net/jqus6bmw/
Upvotes: 1