How to iterate through a table rows and get the cell values using jQuery

前端 未结 5 1415
天涯浪人
天涯浪人 2020-12-30 04:16

I am creating the below table dynamically using jQuery... After executing my code I get the table as below:

5条回答
  •  醉酒成梦
    2020-12-30 05:04

    Looping through a table for each row and reading the 1st column value works by using JQuery and DOM logic.

    var i = 0;
    var t = document.getElementById('flex1');
    
    $("#flex1 tr").each(function() {
        var val1 = $(t.rows[i].cells[0]).text();
        alert(val1) ;
        i++;
    });
    

提交回复
热议问题