javascript - jQuery gets all data from table
phpcn_u1582
phpcn_u1582 2017-06-30 09:58:28
0
1
930

As shown in the picture, clicking the Add a Row button will add a row. After filling in the data, click Save below and it will be inserted into the database. The question now is how to get all the data in the table? Please post the code

phpcn_u1582
phpcn_u1582

reply all(1)
我想大声告诉你
var set = [];
$('table tr').each(function() {
    var row = [];
    
    $(this).find('td').each(function() {
        row.push($(this).text());
    });
    
    set.push(row);
});

In this way, all the td items in the entire table will be stored in a two-dimensional array set in order from row to column, similar to the structure below

[
    [列1, 列2, ...], // 行1
    [列1, 列2, ...], // 行2
    ...
]
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template