jquery - fastest way to remove all rows from a very large table

前端 未结 8 602
臣服心动
臣服心动 2021-01-30 09:40

I thought this might be a fast way to remove the contents of a very large table (3000 rows):

$jq(\"tbody\", myTable).remove();

But it\'s taking

8条回答
  •  余生分开走
    2021-01-30 10:41

    It's better to avoid any kind of loops, just remove all elements directly like this:

    $("#mytable > tbody").html("");
    

提交回复
热议问题