SR1092
SR1092

Reputation: 565

Serial Number for dynamic table using jQuery

I have a dynamic table which has 2 dynamic rows .i.e students and their subjects and marks. The code is below :

Click here to view the code

Code for Serial Number

 function numberRows() {
      $('input[name^="SNo"]').each(function(i) {
            $(this).val(i + 1);
      });
        }
    numberRows();

Output that comes :

enter image description here

Output expected

enter image description here

The serial numbers are not generated dynamically. Where could I have possibly gone wrong? Would appreciate any help/ suggestions! :)

Upvotes: 0

Views: 1008

Answers (1)

khushboo29
khushboo29

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

Related Questions