jquery table row code example

Example 1: Add table row in jQuery

$('#myTable tr:last').after('<tr>...</tr><tr>...</tr>');

//OR

$('#myTable > tbody:last-child').append('<tr>...</tr><tr>...</tr>');

Example 2: jquery append table row

$('#someTableID tr:last').after('<tr><td>Some data here</td></tr>');

Example 3: jquery grab table row

$('.itemTable').eq(2);
//this will grab the 3rd row of the table with the class itemTable

Example 4: get table row data jquery

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table cellspacing="0" cellpadding="0" border="0" class="layui-table">
  <tbody>
    <tr data-index="0" class="">
      <td data-field="sid" data-content="123456">
        <div class="layui-table-cell laytable-cell-1-sid"> 123456 </div>
      </td>
      <td>
        <div></div>
      </td>
    </tr>
    <tr data-index="1" class="">
      <td data-field="sid" data-content="100012">
        <div class="layui-table-cell laytable-cell-1-sid"> 100012 </div>
      </td>
      <td>
        <div></div>
      </td>
    </tr>
  </tbody>
</table>