title: renumber appended table row in javascript after deleting
body: <pre><code>    $('#mhTable').on('click', '.DeleteRow', function() 
      {
          if(confirm("Are you sure you want to delete this?")) {
          $(this).closest('tr').remove();
          count --;
          }
          else {
              return false;
          }
      });
  </code></pre>
  
  <p>hi i have these code to delete a table row, my problem is that when i delete a row that is in between the numbers, for example i have 4 rows and i delete row#2 the numbering of the rows will be like 1,3,4.. but i need it to be 1,2,3 how will i achieved this? thank you for your help</p>
  
  <p>here's how i add the tables dynamically</p>
  
  <pre><code>var rowCount = $('#mhTable &gt;tbody &gt;tr').length;
  var count = rowCount + 1;
  var host = window.location.protocol + "//" + window.location.host + "/" + "\files/Icons/delete.png";
      $('#mhAddRow').click(function(e) 
      {
          $("#mhTable tr:last").after('&lt;tr id="row' + count + '"&gt;'
          + '&lt;td&gt; &lt;sup&gt; &lt;img class="DeleteRow" style="cursor:pointer;" id="rowDelete" name="rowDelete" height="7" width="7" src="'+host+'"&gt; &lt;/sup&gt; &lt;input type="text" id="rowsID'+count+'" name="rows['+count+']" style="width:73%;text-align:center;" value="'+count+'" readOnly="readonly"&gt; &lt;/input&gt; &lt;/td&gt;'
  
          + '&lt;td&gt; &lt;input type="text" style="width:98%;" id="process" class="process" name="process['+count+']" value=""&gt; &lt;/input&gt; &lt;/td&gt;'
  
          + '&lt;td&gt; &lt;input type="text" style="width:96%;" id="PIC" class="PIC" name="PIC['+count+']" value="" &gt; &lt;/input&gt; &lt;/td&gt; '
  
          + '&lt;td&gt; &lt;input type="text" style="width:95%;text-align:right;" id="prev" class="prev" name="prev['+count+']" onkeyup="ManhourSaving();totalmhPrevious();ManhourSavingRatio();mhInMinutes();savedMHyearly();costAnnual()" onkeypress="return isNumberKey(event)" maxlength="5" value="" &gt;&lt;/input&gt; &lt;/td&gt; '
  
          + '&lt;td&gt; &lt;input type="text" style="width:95%;text-align:right;" id="expect" class="expect" name="expect['+count+']" class="expected" onkeyup="ManhourSaving();totalmhExpected();ManhourSavingRatio();mhInMinutes();savedMHyearly();costAnnual()" onkeypress="return isNumberKey(event)" maxlength="5" value="" &gt; &lt;/input&gt; &lt;/td&gt; '
  
          + '&lt;td&gt; &lt;input type="text" style="width:96%;text-align:right;" id="mhSavings" class="mhSavings" name="mhSavings['+count+']" readOnly="readonly" value="0.00" &gt; &lt;/input&gt; &lt;/td&gt; '
  
          + '&lt;td&gt; &lt;input  type="text" style="width:95%;text-align:right;" id="ratio" class="ratio" name="ratio['+count+']" readOnly="readonly" value="0.00" &gt; &lt;/input&gt; &lt;/td&gt; '
  
          + '&lt;td&gt; &lt;input type="text" style="width:95%;text-align:right;" id="PaperReducPrev" class="PaperReducPrev" name="PaperReducPrev['+count+']"onkeyup="PaperReductionPrevious();PaperReduction();PaperReductionRatio();totalPaperReduced();paperReductionyearly();costSheet()" onkeypress="return isNumberKey(event)" maxlength="5" value="" &gt; &lt;/input&gt; &lt;/td&gt;'
  
          + '&lt;td&gt; &lt;input type="text" style="width:95%;text-align:right;" id="PaperReducExpect" class="PaperReducExpect" name="PaperReducExpect['+count+']" onkeyup="PaperReductionExpected();PaperReduction();PaperReductionRatio();totalPaperReduced();paperReductionyearly();costSheet()" onkeypress="return isNumberKey(event)" maxlength="5" value="" &gt; &lt;/input&gt; &lt;/td&gt;'
  
          + '&lt;td&gt; &lt;input type="text" style="width:96%;text-align:right;" id="paperReduced" class="paperReduced" name="paperReduced['+count+']" readOnly="readonly" value="0"&gt; &lt;/input&gt; &lt;/td&gt; '
  
          + '&lt;td&gt; &lt;input type="text" style="width:95%;text-align:right;" id="PaperReducRatio" class="PaperReducRatio" name="paperReducRatio['+count+']" readOnly="readonly" value="0.00" &gt; &lt;/input&gt;  &lt;/td&gt; ');
  
          $.post('mis.php/new_development_request/loadView_newDevelopmentRequest', {counter: count});
          count++;
      });
  </code></pre>