How to set table cell value using jquery

后端 未结 5 870
情书的邮戳
情书的邮戳 2021-02-09 18:30

I would like to set the value of all the cells of a table by iterating through them. Ideally I would like to access a Html table like an array i.e. $(\"#tbl\")[row][col]=\

5条回答
  •  执念已碎
    2021-02-09 18:55

    $(document).ready(function () {
        var $rows = $("#tbl").find("tr");
        for (var row = 0; row < 3; row++) {
           var $columns = $($rows[row]).find("td"); 
           for (var col = 0; col < 3; col++) {
                 $($columns[col]).append("sdfasdf");
            }
         }
    });
    

提交回复
热议问题