title: How to avoid appending rest of the <td>s except first one from a new <tr> appended to the <tbody> using jQuery?
body: <p>I've a table in HTML. Actually there can be many such tables present with different Ids. I'm appending a new table row on click of a button using jQuery. The table has six columns. The first row of a table which is present when the page loads contains HTML elements in all it's six columns. The next row contains Add button in first column with other five <code>&lt;td&gt;&lt;/td&gt;</code>When I click on this Add button I want to append a new row which will contain only first <code>&lt;td&gt;</code> with it's HTML element and other five <code>&lt;td&gt;&lt;/td&gt;</code> shouldn't be displayed. How to achieve this?
  My HTML is as follows:</p>
  
  <pre><code>&lt;table id="blacklistgrid_1"  class="table table-bordered table-hover table-striped"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th style="vertical-align:middle"&gt;Products&lt;/th&gt;
        &lt;th style="vertical-align:middle"&gt;Pack Of&lt;/th&gt;
        &lt;th style="vertical-align:middle"&gt;Quantity&lt;/th&gt;
        &lt;th style="vertical-align:middle"&gt;Volume&lt;/th&gt;
        &lt;th style="vertical-align:middle"&gt;Unit&lt;/th&gt;
        &lt;th style="vertical-align:middle"&gt;Rebate Amount&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody class="apnd-test"&gt;
      &lt;tr id="reb1_1"&gt;
        &lt;td&gt;
          &lt;div class="btn-group"&gt;
            &lt;select name="product_id_1[1]" id="product_id_1_1" class="form-control prod_list"&gt;
              &lt;option value=""  selected='selected'&gt;Select Product&lt;/option&gt;
            &lt;/select&gt;
          &lt;/div&gt;
        &lt;/td&gt;
        &lt;td&gt;
          &lt;input type="text" name="pack[1]" id="pack_1" value="" class="form-control" size="8"/&gt;
        &lt;/td&gt;
        &lt;td&gt;
          &lt;input type="text" name="quantity[1]" id="quantity_1" value="" class="form-control" size="8"/&gt;
        &lt;/td&gt;
        &lt;td&gt;
          &lt;input type="text" name="volume[1]" id="volume_1" value="" class="form-control" size="8"/&gt;
        &lt;/td&gt;
        &lt;td&gt;
          &lt;div class="btn-group"&gt;
            &lt;select name="units[1]" id="units_1" class="form-control"&gt;
              &lt;option value=""  selected='selected'&gt;Select Unit&lt;/option&gt;
              &lt;option value="5" &gt;Microsecond&lt;/option&gt;
              &lt;option value="7" &gt;oz&lt;/option&gt;
              &lt;option value="9" &gt;ml&lt;/option&gt;
              &lt;option value="10" &gt;L&lt;/option&gt;
              &lt;option value="12" &gt;gms&lt;/option&gt;
            &lt;/select&gt;
          &lt;/div&gt;
        &lt;/td&gt;
        &lt;td&gt;
          &lt;input type="text" name="amount[1]" id="amount_1" value="" class="form-control" size="9"/&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;tfoot&gt;
      &lt;tr id="reb1_2"&gt;
        &lt;td&gt;&lt;button style="float:right; margin-bottom: 20px" class="products" type="button" class="btn btn-default" onclick=""&gt;&amp;nbsp;Add&lt;/button&gt;&lt;/td&gt;
        &lt;td colspan="5"&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tfoot&gt;                                           
  &lt;/table&gt;
  </code></pre>
  
  <p>The jQuery function I've written to append a new row is as follows:</p>
  
  <pre><code>$(function () {
  //function to create new row in add rebate by product grid 
    $(document).delegate('.products','click',function (e) {
      var table_id = $(this).closest('table').attr('id');
      var no = table_id.match(/\d+/)[0];            
      var first_row = $('#'+table_id).find('tbody tr:first').attr('id');
      var new_row = $('#'+first_row).clone();
      var tbody = $('#' + table_id + ' tbody');
      var n = $('tr', tbody).length  + 1;
      new_row.attr('id', 'reb' + no +'_'+ n);    
  
      $(':input', new_row).not('.prod_list').remove();
      $('select', new_row).attr('name','product_id_'+no+'['+n+']');
      $('select', new_row).attr('id','product_id_'+no+'_'+n);
      $('&lt;button style="color:#C00; opacity: 2;margin-top: 6px;" type="button" class="close delete" data-dismiss="alert" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;').appendTo( $(new_row.find('td:first')) );
      tbody.append(new_row);
  
      //function to delete row from add rebate by product grid 
      $('.delete').on('click', deleteRow);      
    });  
  });
  </code></pre>
  
  <p>I'm able to append the new table row successfullly in each of the tables present on page. There is no issue with it. The issue I want solution for it is the rest of the <code>&lt;td&gt;&lt;/td&gt;</code> should not displayed in a newly added row. Due to these blank <code>&lt;td&gt;&lt;/td&gt;</code> the table seems incomplete to the user. Only first column should be displayed over there. How to achieve this? Can some one please help me in this regard? I'm using jquery-1.9.1.min.js.<br>
  My <a href="http://jsfiddle.net/AHgu4/3/" rel="nofollow noreferrer">jsFIddle</a>. </p>
  
  <p>In jsFiddle table borders are not displayin but in my working instance it does. I don;t want to show those blank <code>&lt;td&gt;&lt;/td&gt;</code>s.    </p>
  
  <p><img src="https://i.stack.imgur.com/9p4De.png" alt="enter image description here"></p>