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

前端 未结 8 596
臣服心动
臣服心动 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:40
    $("#myTable > tbody").empty();
    

    It won't touch the headers.

    0 讨论(0)
  • 2021-01-30 10:41

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

    $("#mytable > tbody").html("");
    
    0 讨论(0)
提交回复
热议问题