clear table jquery

后端 未结 10 1726
耶瑟儿~
耶瑟儿~ 2021-01-30 05:03

I have an HTML table filled with a number of rows.

How can I remove all the rows from the table?

10条回答
  •  渐次进展
    2021-01-30 05:29

    If you want to clear the data but keep the headers:

    $('#myTableId tbody').empty();
    

    The table must be formatted in this manner:

    header1header2
    data1data2

提交回复
热议问题