title: How to change table row ID dynamically based on the row delete?
body: <p>I have a table with 5 rows, My requirement is to add/delete table row dynamically..at the same time to handle the table row id dynamically.</p>
  
  <p>Please find my table here:</p>
  
  <pre><code>&lt;table&gt;
  &lt;tbody&gt;
      &lt;tr id='1'&gt;
          &lt;td&gt;Row 1&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr id='2'&gt;
          &lt;td&gt;Row 2&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr id='3'&gt;
          &lt;td&gt;Row 3&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr id='4'&gt;
          &lt;td&gt;Row 4&lt;/td&gt;    
      &lt;/tr&gt;
      &lt;tr id='5'&gt;
          &lt;td&gt;Row 5&lt;/td&gt;    
      &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p></p>
  
  <p>I am using jquery below code for deletion. For ex. I am deleting second row, then the row id 2 has been deleted and row id should be interchange dynamically.</p>
  
  <p>Find my script here:</p>
  
  <pre><code>var index = $(this).closest('tr').index();
  if (index &gt; 0) {
       $(this).closest('tr').remove();
  }
  </code></pre>
  
  <p>Any help on this?</p>