title: Dynamically adding/removing rows in a table using jQuery/Javascript
body: <p>I had gone through many solutions for the above problem but they are quite confusing as I 'cell left &amp; cell right' didn't seem to be applicable in my case.</p>
  
  <p>Using clone method of jQuery is quite simpler, but there is also one problem. The problem is that when I clone the last row it will copy all data from above row. another problem attached to it is : ID. When cloning is done, same 'name' &amp; 'ID' is copied which will create problem while posting data, so I need dynamics in this too. So I m not getting that how can we pass data to clone function which will solve dynamic 'attribute' problem.</p>
  
  <p>CODE:</p>
  
  <pre><code>&lt;table id="advertisement_main_table" class="table" cellpadding="4" cellspacing="1" width="100%;"&gt;  
  &lt;tr class="odd align_center"&gt;
                      &lt;td&gt;1.&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" id="ad_elements" class="textbox_150_with_border"&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;textarea id="ad_description" rows="01" cols="50" class="advertisement_textarea" &gt;&lt;/textarea&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" id="ad_duration" class="textbox_60_with_border"&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" id="ad_loop_day" class="textbox_60_with_border"&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" id="ad_seconds_played" class="textbox_100_with_border"&gt;&lt;/td&gt;
                  &lt;/tr&gt;&lt;/table&gt;
  </code></pre>
  
  <p>Now in above code <code>&lt;td&gt;1.&lt;/td&gt;</code> is hardcoded but how to appended 'suffix' in every id like 'ad_element_1','ad_duration_1',,,'ad_element_2','ad_duration_2' in next <code>&lt;tr&gt;</code> and so on..</p>
  
  <p>I hope you understand what I want to say</p>