1$("document").ready(function() {
2 var tb = $('.layui-table:eq(0) tbody');
3 var size = tb.find("tr").length;
4 console.log("Number of rows : " + size);
5 tb.find("tr").each(function(index, element) {
6 var colSize = $(element).find('td').length;
7 console.log(" Number of cols in row " + (index + 1) + " : " + colSize);
8 $(element).find('td').each(function(index, element) {
9 var colVal = $(element).text();
10 console.log(" Value in col " + (index + 1) + " : " + colVal.trim());
11 });
12 });
13});
1<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
2<table cellspacing="0" cellpadding="0" border="0" class="layui-table">
3 <tbody>
4 <tr data-index="0" class="">
5 <td data-field="sid" data-content="123456">
6 <div class="layui-table-cell laytable-cell-1-sid"> 123456 </div>
7 </td>
8 <td>
9 <div></div>
10 </td>
11 </tr>
12 <tr data-index="1" class="">
13 <td data-field="sid" data-content="100012">
14 <div class="layui-table-cell laytable-cell-1-sid"> 100012 </div>
15 </td>
16 <td>
17 <div></div>
18 </td>
19 </tr>
20 </tbody>
21</table>