Adding rows and columns to a table dynamically with jQuery

后端 未结 3 1663
囚心锁ツ
囚心锁ツ 2021-01-12 08:55

I have the following JavaScript code:

function addRowToTable()
{
  var tbl = document.getElementById(\'tblSample\');
  var lastRow = tbl.rows.length;
  // if         


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-12 09:38

    The easiest way is to simply use $('#tblSample').append(' ... '), manually entering the html string (if it's constant). You can also read the html from somewhere else, for more readable code:

     $('#tblSample').append($('div#blank-row-container').html());
    

提交回复
热议问题