Create HTML table using Javascript

后端 未结 3 1082
陌清茗
陌清茗 2020-12-13 19:43

My question will ultimately be related to this site:

http://dbtest.net16.net/ethanol-01.html

EDIT: View unencrypted page source code here >>> http://dbtest.n

3条回答
  •  误落风尘
    2020-12-13 20:21

    This beautiful code here creates a table with each td having array values. Not my code, but it helped me!

    var rows = 6, cols = 7;
    
    for(var i = 0; i < rows; i++) {
      $('table').append('');
      for(var j = 0; j < cols; j++) {
        $('table').find('tr').eq(i).append('');
        $('table').find('tr').eq(i).find('td').eq(j).attr('data-row', i).attr('data-col', j);
      }
    }
    

提交回复
热议问题