Dynamic creation of table with DOM

前端 未结 9 1080
面向向阳花
面向向阳花 2020-11-28 06:07

Can someone tell me what\'s wrong with this code? I want to create a table with 2 columns and 3 rows, and in the cells I want Text1 and Text2 on every row. This code creates

9条回答
  •  日久生厌
    2020-11-28 06:52

    var html = "";
        for (var i = 0; i < data.length; i++){
        html +=""+
                ""+ (i+1) + ""+
                ""+ data[i].name + ""+
                ""+ data[i].number + ""+
                ""+ data[i].city + ""+
                ""+ data[i].hobby + ""+
                ""+ data[i].birthdate + ""+""+"";
    }
    $("#tableHtml").html(html);
    

提交回复
热议问题