In jQuery, how to efficiently add lots of elements?

后端 未结 2 2011
执念已碎
执念已碎 2021-01-14 02:12

I currently have a sketch for a truthtable generator. While it works fine, it is rather slow. Each combination of boolean values I have added to a

2条回答
  •  独厮守ぢ
    2021-01-14 02:52

    To defer rendering, you could try creating a new table without adding it to the DOM like:

    var myDisconnectedTable = $('
')

Then adding your rows to that table:

myDisconnectedTable.append(...)

Then append your table to the div you want it in:

$('#idOfMyDiv').append(myDisconnectedTable)

I don't know that it will help, but it's worth a shot.

提交回复
热议问题